diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0c1c98ef9..be3f710f3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -287,7 +287,7 @@ jobs: platform: "android" runs-on: "ubuntu-latest" briefcase-run-prefix: JAVA_HOME=${JAVA_HOME_17_X64} - briefcase-run-args: > + briefcase-run-args: >- --device '{"avd":"beePhone","skin":"pixel_3a"}' --Xemulator=-no-window --Xemulator=-no-snapshot @@ -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 diff --git a/testbed/tests/testbed.py b/testbed/tests/testbed.py index 00a6858ead..de96b7137b 100644 --- a/testbed/tests/testbed.py +++ b/testbed/tests/testbed.py @@ -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) @@ -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 @@ -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: @@ -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, diff --git a/testbed/tests/widgets/test_canvas.py b/testbed/tests/widgets/test_canvas.py index e351ed1364..3ac2878766 100644 --- a/testbed/tests/widgets/test_canvas.py +++ b/testbed/tests/widgets/test_canvas.py @@ -1,4 +1,5 @@ import math +import os from math import pi, radians from unittest.mock import Mock, call @@ -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"