Skip to content

Commit

Permalink
Allow canvas test test_multiline_text to fail outside CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Jun 21, 2024
1 parent 150d32a commit 3f0d865
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ jobs:
timeout-minutes: 15
run: |
${{ matrix.briefcase-run-prefix }} \
briefcase run ${{ matrix.platform }} --log --test ${{ matrix.briefcase-run-args }}
briefcase run ${{ matrix.platform }} --log --test ${{ matrix.briefcase-run-args }} -- --ci
- name: Upload Logs
uses: actions/upload-artifact@v4.3.3
Expand Down
11 changes: 10 additions & 1 deletion testbed/tests/testbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from testbed.app import main


def run_tests(app, cov, args, report_coverage, run_slow):
def run_tests(app, cov, args, report_coverage, run_slow, running_in_ci):
try:
# Wait for the app's main window to be visible.
print("Waiting for app to be ready for testing... ", end="", flush=True)
Expand All @@ -26,6 +26,8 @@ def run_tests(app, cov, args, report_coverage, run_slow):
project_path = Path(__file__).parent.parent
os.chdir(project_path)

os.environ["RUNNING_IN_CI"] = "true" if running_in_ci else ""

app.returncode = pytest.main(
[
# Output formatting
Expand Down Expand Up @@ -146,6 +148,12 @@ def run_tests(app, cov, args, report_coverage, run_slow):
except ValueError:
report_coverage = False

try:
args.remove("--ci")
running_in_ci = True
except ValueError:
running_in_ci = False

# If there are no other specified arguments, default to running the whole suite,
# and reporting coverage.
if len(args) == 0:
Expand All @@ -160,6 +168,7 @@ def run_tests(app, cov, args, report_coverage, run_slow):
args=args,
run_slow=run_slow,
report_coverage=report_coverage,
running_in_ci=running_in_ci,
)
)
# Queue a background task to run that will start the main thread. We do this,
Expand Down
5 changes: 5 additions & 0 deletions testbed/tests/widgets/test_canvas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import math
import os
from math import pi, radians
from unittest.mock import Mock, call

Expand Down Expand Up @@ -693,6 +694,10 @@ async def test_write_text(canvas, probe):
assert_reference(probe, "write_text", threshold=0.07)


@pytest.mark.xfail(
condition=os.environ.get("RUNNING_IN_CI") != "true",
reason="may fail outside of CI",
)
async def test_multiline_text(canvas, probe):
"Multiline text can be measured and written"

Expand Down

0 comments on commit 3f0d865

Please sign in to comment.