From 5001975e660c5150241fc37d76241b6e16d5a7b3 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Sun, 2 Aug 2026 22:55:39 +0630 Subject: [PATCH 01/15] fix: to avoid E501 error in files under tests/integrations --- .gitignore | 1 + pyproject.toml | 2 +- .../integrations/android_sdk/ADB/test_run.py | 3 +- .../android_sdk/ADB/test_start_app.py | 5 +- .../AndroidSDK/test_list_installed_images.py | 22 ++++--- .../android_sdk/AndroidSDK/test_properties.py | 5 +- .../AndroidSDK/test_start_emulator.py | 9 ++- .../AndroidSDK/test_verify_system_image.py | 20 ++++-- tests/integrations/base/test_ToolCache.py | 3 +- tests/integrations/docker/conftest.py | 3 +- .../docker/test_Docker__verify.py | 62 +++++++++++-------- .../docker/test_Docker__x11_passthrough.py | 19 ++++-- .../integrations/file/test_File__download.py | 3 +- .../file/test_File__sorted_depth_first.py | 3 +- .../flatpak/test_Flatpak__verify.py | 10 ++- .../flatpak/test_Flatpak__verify_repo.py | 5 +- .../flatpak/test_Flatpak__verify_runtime.py | 6 +- tests/integrations/git/test_Git__verify.py | 5 +- tests/integrations/subprocess/conftest.py | 3 +- .../subprocess/test_PopenOutputStreamer.py | 3 +- .../noop/test_NoOpEnvManager.py | 3 +- .../visualstudio/test_VisualStudio__verify.py | 44 +++++++++---- .../test_WindowsSDK___verify_signtool.py | 3 +- .../windows_sdk/test_WindowsSDK__verify.py | 40 ++++++++---- .../xcode/test_ensure_xcode_is_installed.py | 18 +++++- .../integrations/xcode/test_get_identities.py | 28 ++++++--- .../integrations/xcode/test_get_simulators.py | 24 +++++-- 27 files changed, 249 insertions(+), 103 deletions(-) diff --git a/.gitignore b/.gitignore index 6d41bb98fb..4cd827d018 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ venv* /local __pycache__/ .ruff_cache/ +.venv/ /pip-wheel-metadata # IntelliJ Idea family of suites diff --git a/pyproject.toml b/pyproject.toml index ef4215065e..67c432d697 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -299,7 +299,7 @@ known-third-party = ["build"] [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes "tests/integrations/*" = ["E501"] -"tests/platforms/*" = ["E501"] +#"tests/platforms/*" = ["E501"] [tool.rumdl] flavor = "mkdocs" diff --git a/tests/integrations/android_sdk/ADB/test_run.py b/tests/integrations/android_sdk/ADB/test_run.py index 43ca1bf447..528106b3cd 100644 --- a/tests/integrations/android_sdk/ADB/test_run.py +++ b/tests/integrations/android_sdk/ADB/test_run.py @@ -93,7 +93,8 @@ def test_older_sdk_error(mock_tools, adb): mock_tools.subprocess.check_output.return_value = "\n".join( [ "Performing Push Install", - "C:/.../app-debug.apk: 1 file pushed, 0 skipped. 5.5 MB/s (33125287 bytes in 5.768s)", + "C:/.../app-debug.apk: 1 file pushed, 0 skipped. ", + "5.5 MB/s (33125287 bytes in 5.768s)", " pkg: /data/local/tmp/app-debug.apk", "Failure [INSTALL_FAILED_OLDER_SDK]", ] diff --git a/tests/integrations/android_sdk/ADB/test_start_app.py b/tests/integrations/android_sdk/ADB/test_start_app.py index 1c6a0d5259..d6ae2594fa 100644 --- a/tests/integrations/android_sdk/ADB/test_start_app.py +++ b/tests/integrations/android_sdk/ADB/test_start_app.py @@ -133,7 +133,10 @@ def test_unable_to_start(adb): with pytest.raises( BriefcaseCommandError, - match=r"Unable to start com.example.sample.package/com.example.sample.activity on exampleDevice", + match=( + r"Unable to start com.example.sample.package/" + r"com.example.sample.activity on exampleDevice" + ), ): adb.start_app( "com.example.sample.package", "com.example.sample.activity", [], {} diff --git a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py index a95ec1f63b..f8f095f24b 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py @@ -10,10 +10,15 @@ def test_list_installed_system_images(mock_tools, android_sdk): mock_tools.subprocess.check_output.return_value = ( "Installed packages:\n" - " Path | Version | Description | Location\n" - " ------- | ------- | ------- | -------\n" - " system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" - " emulator | 35.4.9 | Android Emulator | emulator\n" + " Path | Version | " + "Description | Location\n" + " ------- | ------- | " + "------- | -------\n" + " system-images;android-31;default;x86_64 | 5 | " + "Intel x86_64 Atom System Image | " + "system-images/android-31/default/x86_64\n" + " emulator | 35.4.9 | " + "Android Emulator | emulator\n" ) result = android_sdk.list_installed_system_images() @@ -29,9 +34,12 @@ def test_no_installed_system_images(mock_tools, android_sdk): """If no system images are installed, an empty set is returned.""" mock_tools.subprocess.check_output.return_value = ( "Installed packages:\n" - " Path | Version | Description | Location\n" - " ------- | ------- | ------- | -------\n" - " emulator | 35.4.9 | Android Emulator | emulator\n" + " Path | Version | " + "Description | Location\n" + " ------- | ------- | " + "------- | -------\n" + " emulator | 35.4.9 | " + "Android Emulator | emulator\n" ) result = android_sdk.list_installed_system_images() diff --git a/tests/integrations/android_sdk/AndroidSDK/test_properties.py b/tests/integrations/android_sdk/AndroidSDK/test_properties.py index caa60fae76..8de0396459 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_properties.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_properties.py @@ -141,7 +141,10 @@ def test_bad_emulator_abi(mock_tools, android_sdk, host_os, host_arch): with pytest.raises( BriefcaseCommandError, - match=rf"The Android emulator does not currently support {host_os} {host_arch} hardware.", + match=( + rf"The Android emulator does not currently support {host_os} " + rf"{host_arch} hardware." + ), ): _ = android_sdk.emulator_abi diff --git a/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py b/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py index ab71607b02..2dd5c8621b 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py @@ -375,14 +375,19 @@ def test_emulator_fail_to_boot(mock_tools, android_sdk): # 3 calls to avd_name and then 3 calls to getprop android_sdk.mock_run.side_effect = [ # emu avd_name - subprocess.CalledProcessError(returncode=1, cmd="emu avd name"), + subprocess.CalledProcessError( + returncode=1, + cmd="emu avd name", + ), "runningEmulator\nOK", "idleEmulator\nOK", # shell getprop sys.boot_completed "\n", # gets in to emulator has_booted() if block "\n", # enters has_booted() while loop "\n", # one loop waiting for simulator to finish booting - "1\n", # successful boot...except poll() will return non-None first raising failure + # successful boot...except poll() will return + # non-None first raising failure + "1\n", ] # poll() on the process returns failure during simulator boot diff --git a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py index 26ca2f2232..7ae6d24124 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py @@ -21,7 +21,10 @@ def test_unsupported_abi(mock_tools, android_sdk, host_os, host_arch): with pytest.raises( BriefcaseCommandError, - match=f"The Android emulator does not currently support {host_os} {host_arch} hardware", + match=( + f"The Android emulator does not currently support {host_os} " + f"{host_arch} hardware" + ), ): android_sdk.verify_system_image("system-images;android-31;default;x86_64") @@ -84,9 +87,13 @@ def test_existing_system_image(mock_tools, android_sdk): # Mock sdkmanager reporting the system image as installed mock_tools.subprocess.check_output.return_value = ( "Installed packages:\n" - " Path | Version | Description | Location\n" - " ------- | ------- | ------- | -------\n" - " system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" + " Path | Version | " + "Description | Location\n" + " ------- | ------- | " + "------- | -------\n" + " system-images;android-31;default;x86_64 | 5 | " + "Intel x86_64 Atom System Image | " + "system-images/android-31/default/x86_64\n" ) # Verify the system image that we already have @@ -130,7 +137,10 @@ def test_problem_downloading_system_image(mock_tools, android_sdk): # Attempt to verify the system image with pytest.raises( BriefcaseCommandError, - match=r"Error while installing the 'system-images;android-31;default;x86_64' Android system image\.", + match=( + r"Error while installing the " + r"'system-images;android-31;default;x86_64' Android system image\." + ), ): android_sdk.verify_system_image("system-images;android-31;default;x86_64") diff --git a/tests/integrations/base/test_ToolCache.py b/tests/integrations/base/test_ToolCache.py index feec097739..43d077fbad 100644 --- a/tests/integrations/base/test_ToolCache.py +++ b/tests/integrations/base/test_ToolCache.py @@ -21,7 +21,8 @@ def test_toolcache_typing(): """Tool typing for ToolCache is correct.""" # Tools that are intentionally not annotated in ToolCache. tools_unannotated = {"cookiecutter"} - # Tool names to exclude from the dynamic annotation checks; they are manually checked. + # Tool names to exclude from the dynamic annotation checks; + # they are manually checked. tool_names_skip_dynamic_check = { "app_context", # Tested by the Docker module "git", # An external API, not a Briefcase Tool diff --git a/tests/integrations/docker/conftest.py b/tests/integrations/docker/conftest.py index d156b99d60..8b7afa4a95 100644 --- a/tests/integrations/docker/conftest.py +++ b/tests/integrations/docker/conftest.py @@ -18,7 +18,8 @@ def mock_tools(mock_tools, tmp_path) -> ToolCache: # Mock stdlib subprocess module mock_tools.subprocess._subprocess = MagicMock(spec_set=subprocess) - # Reset `os` mock without `spec` so tests can run on Windows where os.getuid doesn't exist. + # Reset `os` mock without `spec` + # so tests can run on Windows where os.getuid doesn't exist. mock_tools.os = MagicMock() # Mock user and group IDs for docker image mock_tools.os.getuid.return_value = "37" diff --git a/tests/integrations/docker/test_Docker__verify.py b/tests/integrations/docker/test_Docker__verify.py index 47aea264e2..c7519c96c9 100644 --- a/tests/integrations/docker/test_Docker__verify.py +++ b/tests/integrations/docker/test_Docker__verify.py @@ -197,15 +197,19 @@ def test_docker_unknown_version(mock_tools, user_mapping_run_calls, capsys): def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): """If the docker daemon isn't running, the check fails.""" - error_message = """ -Client: - Debug Mode: false - -Server: -ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: - -Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied -errors pretty printing info""" + error_message = ( + "\n" + "Client:\n" + " Debug Mode: false\n" + "\n" + "Server:\n" + "ERROR: Got permission denied while trying to connect to the Docker " + "daemon socket at unix:///var/run/docker.sock:\n" + "\n" + "Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix " + "/var/run/docker.sock: connect: permission denied\n" + "errors pretty printing info" + ) mock_tools.subprocess.check_output.side_effect = [ VALID_DOCKER_VERSION, @@ -225,21 +229,26 @@ def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): @pytest.mark.parametrize( "error_message", [ - """ -Client: - Debug Mode: false - -Server: -ERROR: Error response from daemon: dial unix docker.raw.sock: connect: connection refused -errors pretty printing info -""", # this is the error shown on mac - """ -Client: - Debug Mode: false - -Server: -ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? -errors pretty printing info""", # this is the error show on linux + ( + "\n" + "Client:\n" + " Debug Mode: false\n" + "\n" + "Server:\n" + "ERROR: Error response from daemon: dial unix docker.raw.sock: " + "connect: connection refused\n" + "errors pretty printing info\n" + ), # this is the error shown on mac + ( + "\n" + "Client:\n" + " Debug Mode: false\n" + "\n" + "Server:\n" + "ERROR: Cannot connect to the Docker daemon at " + "unix:///var/run/docker.sock. Is the docker daemon running?\n" + "errors pretty printing info" + ), # this is the error shown on linux ], ) def test_docker_exists_but_is_not_running(error_message, mock_tools): @@ -290,7 +299,10 @@ def test_buildx_plugin_not_installed(mock_tools): with pytest.raises( BriefcaseCommandError, - match="Docker is installed and available for use but the buildx plugin\nis not installed", + match=( + "Docker is installed and available for use but the buildx plugin\n" + "is not installed" + ), ): Docker.verify(mock_tools) diff --git a/tests/integrations/docker/test_Docker__x11_passthrough.py b/tests/integrations/docker/test_Docker__x11_passthrough.py index 4ff1859994..1424af8deb 100644 --- a/tests/integrations/docker/test_Docker__x11_passthrough.py +++ b/tests/integrations/docker/test_Docker__x11_passthrough.py @@ -111,7 +111,8 @@ def test_x11_is_display_tcp( ("is_socket_outcomes", "is_tcp_outcomes", "expected_display_num"), [ ([False], [False], 50), - # Due to short-circuiting, only the first iterator is consumed if it returns False + # Due to short-circuiting, + # only the first iterator is consumed if it returns False ([True, False], [False], 51), ([True, True, False, True, False], [False, False, False], 52), ([True] * 248 + [False, False], [True, False], 299), @@ -365,9 +366,11 @@ def test_x11_write_xauth_success(mock_tools, tmp_path, sub_check_output_kw): "-", ], input=( - "ffff 0007 6a757069746572 0000 0012 4d49542d4d414749432d434f4f4b49452d31 " + "ffff 0007 6a757069746572 0000 0012 " + "4d49542d4d414749432d434f4f4b49452d31 " "0010 fa4b61837675f1581427e0c937701439\n" - "ffff 0007 6a757069746572 0000 0012 4d49542d4d414749432d434f4f4b49452d31 " + "ffff 0007 6a757069746572 0000 0012 " + "4d49542d4d414749432d434f4f4b49452d31 " "0010 fa4b61837675f1581427e0c937701439" ), **sub_check_output_kw, @@ -477,7 +480,9 @@ def test_x11_passthrough_missing_DISPLAY(mock_tools, DISPLAY): with ( pytest.raises( BriefcaseCommandError, - match="The DISPLAY environment variable must be set to run an app in Docker", + match=( + "The DISPLAY environment variable must be set to run an app in Docker" + ), ), mock_tools.docker.x11_passthrough({}), ): @@ -592,9 +597,11 @@ def test_x11_passthrough_xauth_fails(mock_tools, in_kwargs, out_kwargs, capsys): # User is warned that xauth failed assert capsys.readouterr().out == ( - "An X11 authentication database could not be created for the display.\n" + "An X11 authentication database could not be created " + "for the display.\n" "\n" - "Briefcase will proceed, but if access to the display is rejected, this may be why.\n" + "Briefcase will proceed, but if access to the display " + "is rejected, this may be why.\n" ) diff --git a/tests/integrations/file/test_File__download.py b/tests/integrations/file/test_File__download.py index c35e62ab7f..63874aa182 100644 --- a/tests/integrations/file/test_File__download.py +++ b/tests/integrations/file/test_File__download.py @@ -427,7 +427,8 @@ def test_connection_error(mock_tools): # Keep using the fixture though, so that it still gets cleaned up after the test mock_tools.httpx = mock.Mock(wraps=httpx) - # Failure leads to filename never being read, so the error message will use the full URL + # Failure leads to filename never being read, + # so the error message will use the full URL # rather than the filename with pytest.raises(NetworkFailure, match=f"Unable to download {url}"): mock_tools.file.download( diff --git a/tests/integrations/file/test_File__sorted_depth_first.py b/tests/integrations/file/test_File__sorted_depth_first.py index 916289bfdb..f1ec33e644 100644 --- a/tests/integrations/file/test_File__sorted_depth_first.py +++ b/tests/integrations/file/test_File__sorted_depth_first.py @@ -13,7 +13,8 @@ ["foo/bar/a.txt", "foo/bar/c.txt", "foo/bar/b.txt"], ["foo/bar/c.txt", "foo/bar/b.txt", "foo/bar/a.txt"], ), - # Subfolders are sorted before files in that directory; but sorted lexically in themselves + # Subfolders are sorted before files in that directory; + # but sorted lexically in themselves ( [ "foo/bar/b", diff --git a/tests/integrations/flatpak/test_Flatpak__verify.py b/tests/integrations/flatpak/test_Flatpak__verify.py index bb398eeb89..a8c58fbaea 100644 --- a/tests/integrations/flatpak/test_Flatpak__verify.py +++ b/tests/integrations/flatpak/test_Flatpak__verify.py @@ -36,7 +36,10 @@ def test_flatpak_not_installed(mock_tools): with pytest.raises( BriefcaseCommandError, - match=r"Briefcase requires the Flatpak toolchain, but it does not appear to be installed.", + match=( + r"Briefcase requires the Flatpak toolchain, " + r"but it does not appear to be installed." + ), ): Flatpak.verify(mock_tools) @@ -98,7 +101,10 @@ def test_flatpak_builder_not_installed(mock_tools): with pytest.raises( BriefcaseCommandError, - match=r"Briefcase requires the full Flatpak development toolchain, but flatpak-builder", + match=( + r"Briefcase requires the full Flatpak development toolchain, " + r"but flatpak-builder" + ), ): Flatpak.verify(mock_tools) diff --git a/tests/integrations/flatpak/test_Flatpak__verify_repo.py b/tests/integrations/flatpak/test_Flatpak__verify_repo.py index a44ec9f15e..de2758da49 100644 --- a/tests/integrations/flatpak/test_Flatpak__verify_repo.py +++ b/tests/integrations/flatpak/test_Flatpak__verify_repo.py @@ -41,7 +41,10 @@ def test_verify_repo_fail(flatpak): with pytest.raises( BriefcaseCommandError, - match=r"Unable to add Flatpak repo https://example.com/flatpak with alias test-alias.", + match=( + r"Unable to add Flatpak repo " + r"https://example.com/flatpak with alias test-alias." + ), ): flatpak.verify_repo( repo_alias="test-alias", diff --git a/tests/integrations/flatpak/test_Flatpak__verify_runtime.py b/tests/integrations/flatpak/test_Flatpak__verify_runtime.py index dd6ac7a50e..9bae1809b8 100644 --- a/tests/integrations/flatpak/test_Flatpak__verify_runtime.py +++ b/tests/integrations/flatpak/test_Flatpak__verify_runtime.py @@ -49,7 +49,8 @@ def test_verify_runtime_fail(flatpak): with pytest.raises( BriefcaseCommandError, match=( - r"Unable to install Flatpak runtime org.beeware.flatpak.Platform/gothic/37.42 " + r"Unable to install Flatpak runtime " + r"org.beeware.flatpak.Platform/gothic/37.42 " r"and SDK org.beeware.flatpak.SDK/gothic/37.42 from repo test-alias." ), ): @@ -63,7 +64,8 @@ def test_verify_runtime_fail(flatpak): with pytest.raises( BriefcaseCommandError, match=( - r"Unable to install Flatpak runtime org.beeware.flatpak.Platform/gothic/37.42 " + r"Unable to install Flatpak runtime " + r"org.beeware.flatpak.Platform/gothic/37.42 " r"and SDK org.beeware.flatpak.SDK/gothic/37.42 " r"and base org.beeware.flatpak.BaseApp/gothic/1.0 " r"from repo test-alias." diff --git a/tests/integrations/git/test_Git__verify.py b/tests/integrations/git/test_Git__verify.py index ce9d7cd414..188e206e90 100644 --- a/tests/integrations/git/test_Git__verify.py +++ b/tests/integrations/git/test_Git__verify.py @@ -76,6 +76,9 @@ def test_git_version_invalid(mock_tools, version, monkeypatch): with pytest.raises( BriefcaseCommandError, - match=f"At least Git v2.17.0 is required; however, v{'.'.join(map(str, version))} is installed.", + match=( + f"At least Git v2.17.0 is required; " + f"however, v{'.'.join(map(str, version))} is installed." + ), ): Git.verify(mock_tools) diff --git a/tests/integrations/subprocess/conftest.py b/tests/integrations/subprocess/conftest.py index e0bb7095c9..8a9631a96a 100644 --- a/tests/integrations/subprocess/conftest.py +++ b/tests/integrations/subprocess/conftest.py @@ -6,7 +6,8 @@ from briefcase.integrations.subprocess import Subprocess -# hardcoded here since subprocess will only include these constants if Python is literally on Windows +# hardcoded here since subprocess will only include +# these constants if Python is literally on Windows CREATE_NO_WINDOW = 0x8000000 CREATE_NEW_PROCESS_GROUP = 0x200 diff --git a/tests/integrations/subprocess/test_PopenOutputStreamer.py b/tests/integrations/subprocess/test_PopenOutputStreamer.py index e89782a3af..3160eaff77 100644 --- a/tests/integrations/subprocess/test_PopenOutputStreamer.py +++ b/tests/integrations/subprocess/test_PopenOutputStreamer.py @@ -327,6 +327,7 @@ def filter_func(line): # Exception assert capsys.readouterr().out == ( "output line 1\n" - "Error while streaming output: RuntimeError: Like something totally went wrong\n" + "Error while streaming output: RuntimeError: " + "Like something totally went wrong\n" ) # fmt: on diff --git a/tests/integrations/virtual_environment/noop/test_NoOpEnvManager.py b/tests/integrations/virtual_environment/noop/test_NoOpEnvManager.py index 930f82485f..2c60a09478 100644 --- a/tests/integrations/virtual_environment/noop/test_NoOpEnvManager.py +++ b/tests/integrations/virtual_environment/noop/test_NoOpEnvManager.py @@ -43,7 +43,8 @@ def test_existing(noop_venv, recreate): assert noop_venv.exists() # Calling prepare causes the environment to be created - # If a recreate was requested, and the marker file existed, that is reflected in the result + # If a recreate was requested, + # and the marker file existed, that is reflected in the result assert noop_venv.prepare(recreate=recreate) == recreate # Environment still exists, and the marker path points at the executable. diff --git a/tests/integrations/visualstudio/test_VisualStudio__verify.py b/tests/integrations/visualstudio/test_VisualStudio__verify.py index 52f47e316e..a6073fc0c1 100644 --- a/tests/integrations/visualstudio/test_VisualStudio__verify.py +++ b/tests/integrations/visualstudio/test_VisualStudio__verify.py @@ -9,11 +9,13 @@ from briefcase.exceptions import BriefcaseCommandError, UnsupportedHostError from briefcase.integrations.visualstudio import VisualStudio -MSBUILD_OUTPUT = """Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework -Copyright (C) Microsoft Corporation. All rights reserved. - -17.2.1.25201 -""" +MSBUILD_OUTPUT = ( + "Microsoft (R) Build Engine version 17.2.1+52cd2da31 " + "for .NET Framework\n" + "Copyright (C) Microsoft Corporation. All rights reserved.\n" + "\n" + "17.2.1.25201\n" +) @pytest.fixture @@ -259,7 +261,10 @@ def test_vswhere_bad_executable(mock_tools, vswhere_path): # Verify the installation with pytest.raises( BriefcaseCommandError, - match=r"Visual Studio appears to exist, but Briefcase can't retrieve installation metadata.", + match=( + r"Visual Studio appears to exist, " + r"but Briefcase can't retrieve installation metadata.", + ), ): VisualStudio.verify(mock_tools) @@ -287,7 +292,10 @@ def test_vswhere_bad_content(mock_tools, vswhere_path): # Verify the installation with pytest.raises( BriefcaseCommandError, - match=r"Visual Studio appears to exist, but Briefcase can't retrieve installation metadata.", + match=( + r"Visual Studio appears to exist, " + r"but Briefcase can't retrieve installation metadata." + ), ): VisualStudio.verify(mock_tools) @@ -307,16 +315,21 @@ def test_vswhere_bad_content(mock_tools, vswhere_path): def test_vswhere_non_list_content(mock_tools, vswhere_path): """If VSWhere can be executed, but the outermost content isn't a list, an error is raised.""" - # MSBuild is not on the path, and vswhere returns JSON content, but not in the format expected + # MSBuild is not on the path, and vswhere returns JSON content, + # but not in the format expected mock_tools.subprocess.check_output.side_effect = [ FileNotFoundError, # MSBuild not on path - '{"problem": "JSON but not a list"}', # vswhere returns JSON content, but not as a list. + '{"problem": "JSON but not a list"}', + # vswhere returns JSON content, but not as a list. ] # Verify the installation with pytest.raises( BriefcaseCommandError, - match=r"Visual Studio appears to exist, but Briefcase can't retrieve installation metadata.", + match=( + r"Visual Studio appears to exist, " + r"but Briefcase can't retrieve installation metadata." + ), ): VisualStudio.verify(mock_tools) @@ -336,7 +349,8 @@ def test_vswhere_non_list_content(mock_tools, vswhere_path): def test_vswhere_empty_list_content(mock_tools, vswhere_path): """If VSWhere can be executed, but the outermost content is an empty list, an error is raised.""" - # MSBuild is not on the path, and vswhere returns JSON content, but not in the format expected + # MSBuild is not on the path, and vswhere returns JSON content, + # but not in the format expected mock_tools.subprocess.check_output.side_effect = [ FileNotFoundError, # MSBuild not on path "[]", # vswhere returns empty list JSON content @@ -345,7 +359,10 @@ def test_vswhere_empty_list_content(mock_tools, vswhere_path): # Verify the installation with pytest.raises( BriefcaseCommandError, - match=r"Visual Studio appears to exist, but Briefcase can't retrieve installation metadata.", + match=( + r"Visual Studio appears to exist, " + r"but Briefcase can't retrieve installation metadata." + ), ): VisualStudio.verify(mock_tools) @@ -365,7 +382,8 @@ def test_vswhere_empty_list_content(mock_tools, vswhere_path): def test_vswhere_msbuild_not_installed(mock_tools, tmp_path, vswhere_path): """If VSWhere can be executed, but it doesn't point at an MSBuild executable, an error is raised.""" - # MSBuild is not on the path; vswhere a valid location, but there's no MSBuild there. + # MSBuild is not on the path; vswhere a valid location, + # but there's no MSBuild there. mock_tools.subprocess.check_output.side_effect = [ FileNotFoundError, # MSBuild not on path json.dumps( diff --git a/tests/integrations/windows_sdk/test_WindowsSDK___verify_signtool.py b/tests/integrations/windows_sdk/test_WindowsSDK___verify_signtool.py index 8e126edff8..5f547c747b 100644 --- a/tests/integrations/windows_sdk/test_WindowsSDK___verify_signtool.py +++ b/tests/integrations/windows_sdk/test_WindowsSDK___verify_signtool.py @@ -46,7 +46,8 @@ def test_winsdk_signtool_raises_oserror(windows_sdk, tmp_path): ) windows_sdk.tools.subprocess.check_output.side_effect = OSError( 14001, - " The application has failed to start because its side-by-side configuration is incorrect.", + " The application has failed to start because its " + "side-by-side configuration is incorrect.", ) assert WindowsSDK._verify_signtool(windows_sdk) is False diff --git a/tests/integrations/windows_sdk/test_WindowsSDK__verify.py b/tests/integrations/windows_sdk/test_WindowsSDK__verify.py index 98d4e294ec..3648aa9416 100644 --- a/tests/integrations/windows_sdk/test_WindowsSDK__verify.py +++ b/tests/integrations/windows_sdk/test_WindowsSDK__verify.py @@ -40,19 +40,26 @@ def setup_winsdk_install( ) -> (Path, str): """Create a mock Windows SDK for the version and arch. - :param base_path: base path to create the SDK in; should be pytest's tmp_path. - :param version: SDK version triple, e.g. 1.2.3. The created directory path will include - a servicing version of 0, e.g. base_path/win_sdk/1.2.3.0. + :param base_path: base path to create the SDK in; should be pytest's + tmp_path. + :param version: SDK version triple, e.g. 1.2.3. The created directory + path will include a servicing version of 0, e.g. + base_path/win_sdk/1.2.3.0. :param arch: The architecture for the SDK, e.g. amd64 or arm64. :param skip_bins: Do not create mock binaries in `bin` directory. :returns: tuple of path to base of SDK install and version triple """ sdk_path = base_path / "win_sdk" sdk_ver = version - (sdk_path / "bin" / f"{sdk_ver}.0" / arch).mkdir(parents=True, exist_ok=True) + + # Extract the repeated path to keep lines short and clean + bin_dir = sdk_path / "bin" / f"{sdk_ver}.0" / arch + bin_dir.mkdir(parents=True, exist_ok=True) + # Mock the necessary tools in the SDK if not skip_bins: - (sdk_path / "bin" / f"{sdk_ver}.0" / arch / "signtool.exe").touch() + (bin_dir / "signtool.exe").touch() + return sdk_path, sdk_ver @@ -158,7 +165,10 @@ def test_winsdk_invalid_env_vars(mock_tools, mock_winreg, tmp_path, monkeypatch) # Fail validation for missing install from env vars with pytest.raises( BriefcaseCommandError, - match="The 'WindowsSDKDir' and 'WindowsSDKVersion' environment variables do not point", + match=( + "The 'WindowsSDKDir' and 'WindowsSDKVersion' " + "environment variables do not point" + ), ): WindowsSDK.verify(mock_tools) @@ -239,7 +249,8 @@ def test_winsdk_nonlatest_install_from_reg( expected_output = ( "\n" "[Windows SDK] Finding Suitable Installation...\n" - f"Evaluating Registry SDK version '85.0.9.0' at {tmp_path / 'invalid' / 'win_sdk'}\n" + "Evaluating Registry SDK version '85.0.9.0' at " + f"{tmp_path / 'invalid' / 'win_sdk'}\n" f"Evaluating Registry SDK version '85.0.8.0' at {tmp_path / 'win_sdk'}\n" f"Using Windows SDK v85.0.8.0 at {tmp_path / 'win_sdk'}\n" ) @@ -257,9 +268,11 @@ def test_winsdk_nonlatest_install_from_reg( ([("invalid_1", "85.0.1")], []), # One invalid registry install with missing SDK version; no additional installs ([("invalid_1", "")], []), - # One invalid registry install but directory key lookup fails; no additional installs + # One invalid registry install but directory key lookup fails; + # no additional installs ([("invalid_1", "85.0.1"), (FileNotFoundError, "")], []), - # One invalid registry install but version key lookup fails; no additional installs + # One invalid registry install but version key lookup fails; + # no additional installs ([("invalid_1", "85.0.1"), ("invalid_1", FileNotFoundError)], []), # Multiple invalid registry installs; no additional installs ([("invalid_1", "85.0.1"), ("invalid_2", "85.0.2")], []), @@ -384,7 +397,8 @@ def test_winsdk_valid_install_from_default_dir( expected_output = ( "\n" "[Windows SDK] Finding Suitable Installation...\n" - f"Evaluating Default Bin SDK version '86.0.7.0' at {tmp_path / 'invalid' / 'win_sdk'}\n" + "Evaluating Default Bin SDK version '86.0.7.0' " + f"at {tmp_path / 'invalid' / 'win_sdk'}\n" f"Evaluating Default Bin SDK version '86.0.8.0' at {tmp_path / 'win_sdk'}\n" f"Using Windows SDK v86.0.8.0 at {tmp_path / 'win_sdk'}\n" ) @@ -437,7 +451,9 @@ def test_winsdk_invalid_install_from_default_dir( expected_output = ( "\n" "[Windows SDK] Finding Suitable Installation...\n" - f"Evaluating Default Bin SDK version '87.0.7.0' at {tmp_path / 'invalid_1' / 'win_sdk'}\n" - f"Evaluating Default Bin SDK version '87.0.8.0' at {tmp_path / 'invalid_2' / 'win_sdk'}\n" + "Evaluating Default Bin SDK version '87.0.7.0' " + f"at {tmp_path / 'invalid_1' / 'win_sdk'}\n" + "Evaluating Default Bin SDK version '87.0.8.0' " + f"at {tmp_path / 'invalid_2' / 'win_sdk'}\n" ) assert capsys.readouterr().out == expected_output diff --git a/tests/integrations/xcode/test_ensure_xcode_is_installed.py b/tests/integrations/xcode/test_ensure_xcode_is_installed.py index 9298d2dd5c..26a28449ec 100644 --- a/tests/integrations/xcode/test_ensure_xcode_is_installed.py +++ b/tests/integrations/xcode/test_ensure_xcode_is_installed.py @@ -226,8 +226,22 @@ def test_installed_extra_output(capsys, xcode, mock_tools): xcode + "\n", # xcode-select -p "\n".join( [ - "objc[86306]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20d17ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1084b82c8). One of the two will be used. Which one is undefined." - "objc[86306]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20d17abe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1084b8318). One of the two will be used. Which one is undefined.", + ( + "objc[86306]: Class AMSupportURLConnectionDelegate is " + "implemented in both /usr/lib/libauthinstall.dylib " + "(0x20d17ab90) and /Library/Apple/System/Library/" + "PrivateFrameworks/MobileDevice.framework/Versions/A/" + "MobileDevice (0x1084b82c8). One of the two will be used. " + "Which one is undefined." + ), + ( + "objc[86306]: Class AMSupportURLSession is implemented in " + "both /usr/lib/libauthinstall.dylib (0x20d17abe0) and " + "/Library/Apple/System/Library/PrivateFrameworks/" + "MobileDevice.framework/Versions/A/MobileDevice " + "(0x1084b8318). One of the two will be used. Which one is " + "undefined." + ), "Xcode 13.2.1", "Build version 13C100", ] diff --git a/tests/integrations/xcode/test_get_identities.py b/tests/integrations/xcode/test_get_identities.py index 4f07a4f3eb..47865d135f 100644 --- a/tests/integrations/xcode/test_get_identities.py +++ b/tests/integrations/xcode/test_get_identities.py @@ -70,7 +70,9 @@ def test_one_identity(mock_tools): ) assert simulators == { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)" + ), } @@ -88,9 +90,15 @@ def test_multiple_identities(mock_tools): ) assert simulators == { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", - "F8903EC63C238B04C1067833814CE47CA338EBD6": "Developer ID Application: Other Corporation Ltd (83DLZ2K43E)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), + "F8903EC63C238B04C1067833814CE47CA338EBD6": ( + "Developer ID Application: Other Corporation Ltd (83DLZ2K43E)" + ), } @@ -108,7 +116,13 @@ def test_no_profile(mock_tools): ) assert simulators == { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", - "F8903EC63C238B04C1067833814CE47CA338EBD6": "Developer ID Application: Other Corporation Ltd (83DLZ2K43E)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corporation Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), + "F8903EC63C238B04C1067833814CE47CA338EBD6": ( + "Developer ID Application: Other Corporation Ltd (83DLZ2K43E)" + ), } diff --git a/tests/integrations/xcode/test_get_simulators.py b/tests/integrations/xcode/test_get_simulators.py index b46f83c0d7..64f39ee056 100644 --- a/tests/integrations/xcode/test_get_simulators.py +++ b/tests/integrations/xcode/test_get_simulators.py @@ -101,7 +101,9 @@ def test_single_iOS_runtime(mock_tools, simulator): "iOS 13.2": { "20C5B052-F47A-4816-8584-9F1500B50477": "iPad Pro (9.7-inch)", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D": "iPhone 11", - "314E772A-8034-44B4-9B28-3EE80C958F0A": "iPad Pro (12.9-inch) (3rd generation)", + "314E772A-8034-44B4-9B28-3EE80C958F0A": ( + "iPad Pro (12.9-inch) (3rd generation)" + ), "36E4663B-A10F-470F-94E8-05C3DC692AC9": "iPad Pro (11-inch)", "5497F9B2-F4F3-454A-A9DD-993DF44EBB63": "iPhone 8 Plus", "939B1EF6-C25A-4056-B61F-20A2835E89D6": "iPad (7th generation)", @@ -155,7 +157,9 @@ def test_multiple_iOS_runtime(mock_tools, simulator): "iOS 13.2": { "20C5B052-F47A-4816-8584-9F1500B50477": "iPad Pro (9.7-inch)", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D": "iPhone 11", - "314E772A-8034-44B4-9B28-3EE80C958F0A": "iPad Pro (12.9-inch) (3rd generation)", + "314E772A-8034-44B4-9B28-3EE80C958F0A": ( + "iPad Pro (12.9-inch) (3rd generation)" + ), "36E4663B-A10F-470F-94E8-05C3DC692AC9": "iPad Pro (11-inch)", "5497F9B2-F4F3-454A-A9DD-993DF44EBB63": "iPhone 8 Plus", "939B1EF6-C25A-4056-B61F-20A2835E89D6": "iPad (7th generation)", @@ -178,7 +182,9 @@ def test_multiple_iOS_runtime(mock_tools, simulator): "CC954566-F315-4692-A754-DECDF72967CD": "iPhone 5", "D7BBAD14-38FD-48F5-ACFD-B1193F829216": "iPhone 6", "DA9B9F49-A070-4FD7-A6BF-8F49DC72194E": "iPhone 6s Plus", - "E582FF8E-A5DC-4985-B6C8-8D6B1795DF62": "iPad Pro (12.9-inch) (2nd generation)", + "E582FF8E-A5DC-4985-B6C8-8D6B1795DF62": ( + "iPad Pro (12.9-inch) (2nd generation)" + ), "E956D6AE-29F5-4780-A02A-D3426B7B4018": "iPad Pro (12.9 inch)", "F9A6C462-9A4A-438A-B541-848F0E6DBE5A": "iPhone 6s", }, @@ -235,7 +241,9 @@ def test_alternate_format(mock_tools, simulator): "9F055949-5DF2-40D8-A955-A8517F213E24": "iPhone 8 Plus", "A1970E36-8906-48FF-8B3C-819A0A88D9D6": "iPhone 6 Plus", "A604E87D-B2BF-4190-B974-C29FC40A6F15": "iPhone 7 Plus", - "AAF12280-0DC2-472F-87C5-2F141A6F0C55": "iPad Pro (12.9-inch) (2nd generation)", + "AAF12280-0DC2-472F-87C5-2F141A6F0C55": ( + "iPad Pro (12.9-inch) (2nd generation)" + ), "AC8D34EB-F42D-4518-A09C-3C3AD7FCAC8C": "iPhone SE", "C4DE0942-3A85-4091-98CC-C4A90E2D07C3": "iPhone X", "C8E5AD6A-B7EB-480F-89E8-341FD45AAFFC": "iPad Air", @@ -248,7 +256,9 @@ def test_alternate_format(mock_tools, simulator): "04325672-C35F-4E5E-BD08-EAC478B7165C": "iPhone XS", "28F0335D-1B4D-4493-A5C5-4E86E2916178": "iPhone 6", "28F16D36-8878-489F-A8CF-33E7037D252B": "iPad Pro (9.7-inch)", - "512E11C5-5654-4F10-98D7-F75C50DF5DB7": "iPad Pro (12.9-inch) (3rd generation)", + "512E11C5-5654-4F10-98D7-F75C50DF5DB7": ( + "iPad Pro (12.9-inch) (3rd generation)" + ), "53D7FAF6-83D7-415D-A3B4-20A9D8C37C44": "iPhone 5s", "5EF8EAA5-9D63-4F53-8896-57F9D59DECF9": "iPhone 6s", "61D96B3A-3747-41AC-92F7-2177E467A196": "iPad Pro (10.5-inch)", @@ -266,7 +276,9 @@ def test_alternate_format(mock_tools, simulator): "D637BC6D-A53F-4E78-BDA7-FA0D59303350": "iPad Pro (11-inch)", "DC08D810-B9AD-4423-972E-3EE8949BC1F2": "iPad Air", "DEE6AF0E-596D-4713-8B57-8C77D45EED80": "iPad Air 2", - "F022D86A-E404-46C0-98B2-9AB63AD7008B": "iPad Pro (12.9-inch) (2nd generation)", + "F022D86A-E404-46C0-98B2-9AB63AD7008B": ( + "iPad Pro (12.9-inch) (2nd generation)" + ), "F7EF0E11-864C-42A2-8D80-4DBE78AFD86B": "iPhone 6 Plus", }, } From 899452c39f3b7e96f095d99040b76cb689dd8702 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Mon, 3 Aug 2026 14:30:11 +0630 Subject: [PATCH 02/15] fix: to avoid E501 error in files under tests/platforms --- .../gradle/test_android_log_clean_filter.py | 50 ++++-- tests/platforms/android/gradle/test_run.py | 5 +- tests/platforms/iOS/xcode/test_create.py | 64 +++++--- tests/platforms/iOS/xcode/test_run.py | 65 ++++++-- tests/platforms/linux/appimage/test_build.py | 8 +- tests/platforms/linux/appimage/test_run.py | 15 +- tests/platforms/linux/flatpak/test_build.py | 10 +- tests/platforms/linux/flatpak/test_create.py | 5 +- tests/platforms/linux/flatpak/test_mixin.py | 15 +- tests/platforms/linux/system/test_create.py | 13 +- .../system/test_mixin__finalize_app_config.py | 23 ++- .../linux/system/test_mixin__properties.py | 12 +- tests/platforms/linux/system/test_package.py | 5 +- .../linux/system/test_package__deb.py | 5 +- .../linux/system/test_package__pkg.py | 11 +- .../linux/system/test_package__rpm.py | 8 +- tests/platforms/linux/system/test_run.py | 53 +++++-- .../linux/test_LocalRequirementsMixin.py | 9 +- .../platforms/macOS/app/package/test_ditto.py | 37 +++-- .../macOS/app/package/test_notarize.py | 18 ++- .../macOS/app/package/test_package.py | 3 +- .../app/package/test_resume_notarization.py | 12 +- tests/platforms/macOS/app/test_build.py | 3 +- tests/platforms/macOS/app/test_create.py | 106 ++++++++----- tests/platforms/macOS/app/test_signing.py | 150 +++++++++++++----- tests/platforms/macOS/conftest.py | 3 +- tests/platforms/macOS/test_SigningIdentity.py | 4 +- .../platforms/macOS/test_XcodeBuildFilter.py | 109 +++++++++---- .../macOS/test_macOSMixin_verify_tools.py | 6 +- .../macOS/test_macOS_log_clean_filter.py | 39 +++-- tests/platforms/macOS/xcode/test_mixin.py | 5 +- tests/platforms/web/static/test_build.py | 29 ++-- .../web/static/test_build__process_wheel.py | 8 +- .../test_build_extract_pyscript_config.py | 5 +- .../windows/app/create/test_create.py | 6 +- .../app/create/test_install_license.py | 5 +- .../windows/visualstudio/test_run.py | 15 +- 37 files changed, 674 insertions(+), 265 deletions(-) diff --git a/tests/platforms/android/gradle/test_android_log_clean_filter.py b/tests/platforms/android/gradle/test_android_log_clean_filter.py index 653a6fc26f..2618108cab 100644 --- a/tests/platforms/android/gradle/test_android_log_clean_filter.py +++ b/tests/platforms/android/gradle/test_android_log_clean_filter.py @@ -20,15 +20,18 @@ ), ), ( - "\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m", + ("\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m"), ( "loaded /vendor/lib64/egl/libEGL_emulation.so", False, ), ), ( - "D/stdio : Could not find platform independent libraries ", - ("Could not find platform independent libraries ", False), + ("D/stdio : Could not find platform independent libraries "), + ( + "Could not find platform independent libraries ", + False, + ), ), ( "D/MainActivity: onStart() start", @@ -40,12 +43,21 @@ ), # Python App messages ( - "I/python.stdout: Python app launched & stored in Android Activity class", - ("Python app launched & stored in Android Activity class", True), + ("I/python.stdout: Python app launched & stored in Android Activity class"), + ( + "Python app launched & stored in Android Activity class", + True, + ), ), ( - "\x1b[32mI/python.stdout: Python app launched & stored in Android Activity class\x1b[0m", - ("Python app launched & stored in Android Activity class", True), + ( + "\x1b[32mI/python.stdout: Python app launched & " + "stored in Android Activity class\x1b[0m" + ), + ( + "Python app launched & stored in Android Activity class", + True, + ), ), ( "I/python.stdout: ", @@ -60,16 +72,25 @@ ("", True), ), ( - "\x1b[32m\x1b[98mI/python.stdout: this is colored output\x1b[32m\x1b[0m", + ("\x1b[32m\x1b[98mI/python.stdout: this is colored output\x1b[32m\x1b[0m"), ("this is colored output", True), ), ( - "I/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)", - ("test_case (tests.foobar.test_other.TestOtherMethods)", True), + ("I/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)"), + ( + "test_case (tests.foobar.test_other.TestOtherMethods)", + True, + ), ), ( - "\x1b[32mI/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)\x1b[0m", - ("test_case (tests.foobar.test_other.TestOtherMethods)", True), + ( + "\x1b[32mI/python.stderr: test_case " + "(tests.foobar.test_other.TestOtherMethods)\x1b[0m" + ), + ( + "test_case (tests.foobar.test_other.TestOtherMethods)", + True, + ), ), ( "I/python.stderr: ", @@ -86,7 +107,10 @@ ), ( "\x1b[33mThis doesn't match the regex\x1b[33m", - ("\x1b[33mThis doesn't match the regex\x1b[33m", False), + ( + "\x1b[33mThis doesn't match the regex\x1b[33m", + False, + ), ), ], ) diff --git a/tests/platforms/android/gradle/test_run.py b/tests/platforms/android/gradle/test_run.py index 6b91a0791e..8253d8e313 100644 --- a/tests/platforms/android/gradle/test_run.py +++ b/tests/platforms/android/gradle/test_run.py @@ -1082,7 +1082,10 @@ def mock_stream_output(app, stop_func, **kwargs): "sys_path_regex": "requirements$", "host_folder": str( tmp_path - / "base_path/build/first-app/android/gradle/app/build/python/pip/debug/common" + / ( + "base_path/build/first-app/android/gradle/" + "app/build/python/pip/debug/common" + ) ), }, } diff --git a/tests/platforms/iOS/xcode/test_create.py b/tests/platforms/iOS/xcode/test_create.py index 97ed62f061..3c4b77ee62 100644 --- a/tests/platforms/iOS/xcode/test_create.py +++ b/tests/platforms/iOS/xcode/test_create.py @@ -122,7 +122,8 @@ def test_install_requirements( install_path=bundle_path / "app_packages.iphoneos", install_hint=( "\n\n" - "This may be because the `iphoneos` wheels that are available are not compatible\n" + "This may be because the `iphoneos` wheels that are available " + "are not compatible\n" "with Python 3.X and a minimum iOS version of 12.0.\n" ), ) @@ -138,7 +139,8 @@ def test_install_requirements( install_hint=( "\n\n" "This may indicate that an `iphoneos` wheel could be found, but an\n" - "`iphonesimulator` wheel could not be found; or that the `iphonesimulator`\n" + "`iphonesimulator` wheel could not be found; or that the " + "`iphonesimulator`\n" "binary wheels that are available are not compatible with\n" "Python 3.X and a minimum iOS version of 12.0.\n" ), @@ -368,7 +370,9 @@ def test_incompatible_min_os_version( {}, { "info": { - "NSBluetoothAlwaysUsageDescription": "I need to connect to bluetooth device." + "NSBluetoothAlwaysUsageDescription": ( + "I need to connect to bluetooth device." + ) }, }, ), @@ -405,7 +409,9 @@ def test_incompatible_min_os_version( { "info": { "NSLocationDefaultAccuracyReduced": True, - "NSLocationWhenInUseUsageDescription": "I need to know roughly where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know roughly where you are" + ), } }, ), @@ -418,20 +424,26 @@ def test_incompatible_min_os_version( { "info": { "NSLocationDefaultAccuracyReduced": False, - "NSLocationWhenInUseUsageDescription": "I need to know exactly where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know exactly where you are" + ), } }, ), # Background location permissions ( { - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, { "info": { - "NSLocationWhenInUseUsageDescription": "I always need to know where you are", - "NSLocationAlwaysAndWhenInUseUsageDescription": "I always need to know where you are", + "NSLocationWhenInUseUsageDescription": ( + "I always need to know where you are" + ), + "NSLocationAlwaysAndWhenInUseUsageDescription": ( + "I always need to know where you are" + ), "UIBackgroundModes": ["processing", "location"], } }, @@ -440,14 +452,18 @@ def test_incompatible_min_os_version( ( { "coarse_location": "I need to know roughly where you are", - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, { "info": { "NSLocationDefaultAccuracyReduced": True, - "NSLocationWhenInUseUsageDescription": "I need to know roughly where you are", - "NSLocationAlwaysAndWhenInUseUsageDescription": "I always need to know where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know roughly where you are" + ), + "NSLocationAlwaysAndWhenInUseUsageDescription": ( + "I always need to know where you are" + ), "UIBackgroundModes": ["processing", "location"], } }, @@ -456,14 +472,18 @@ def test_incompatible_min_os_version( ( { "fine_location": "I need to know exactly where you are", - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, { "info": { "NSLocationDefaultAccuracyReduced": False, - "NSLocationWhenInUseUsageDescription": "I need to know exactly where you are", - "NSLocationAlwaysAndWhenInUseUsageDescription": "I always need to know where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know exactly where you are" + ), + "NSLocationAlwaysAndWhenInUseUsageDescription": ( + "I always need to know where you are" + ), "UIBackgroundModes": ["processing", "location"], } }, @@ -478,7 +498,9 @@ def test_incompatible_min_os_version( { "info": { "NSLocationDefaultAccuracyReduced": False, - "NSLocationWhenInUseUsageDescription": "I need to know exactly where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know exactly where you are" + ), } }, ), @@ -487,14 +509,18 @@ def test_incompatible_min_os_version( { "coarse_location": "I need to know roughly where you are", "fine_location": "I need to know exactly where you are", - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, { "info": { "NSLocationDefaultAccuracyReduced": False, - "NSLocationWhenInUseUsageDescription": "I need to know exactly where you are", - "NSLocationAlwaysAndWhenInUseUsageDescription": "I always need to know where you are", + "NSLocationWhenInUseUsageDescription": ( + "I need to know exactly where you are" + ), + "NSLocationAlwaysAndWhenInUseUsageDescription": ( + "I always need to know where you are" + ), "UIBackgroundModes": ["processing", "location"], } }, @@ -507,7 +533,7 @@ def test_incompatible_min_os_version( {}, { "info": { - "NSPhotoLibraryAddUsageDescription": "I need to see your library" + "NSPhotoLibraryAddUsageDescription": ("I need to see your library") } }, ), diff --git a/tests/platforms/iOS/xcode/test_run.py b/tests/platforms/iOS/xcode/test_run.py index 70df8bb008..9bfd274348 100644 --- a/tests/platforms/iOS/xcode/test_run.py +++ b/tests/platforms/iOS/xcode/test_run.py @@ -164,7 +164,10 @@ def test_run_app_simulator_booted(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -298,7 +301,10 @@ def test_run_app_simulator_booted_underscore( "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first_app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first_app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -429,7 +435,10 @@ def test_run_app_with_passthrough(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -567,7 +576,10 @@ def test_run_app_simulator_shut_down( "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -711,7 +723,10 @@ def test_run_app_simulator_shutting_down(run_command, first_app_config, tmp_path "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -986,7 +1001,10 @@ def test_run_app_simulator_install_failure(run_command, first_app_config, tmp_pa "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), ] @@ -1090,7 +1108,10 @@ def test_run_app_simulator_launch_failure(run_command, first_app_config, tmp_pat "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -1214,7 +1235,10 @@ def test_run_app_simulator_no_pid(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -1340,7 +1364,10 @@ def test_run_app_simulator_non_integer_pid(run_command, first_app_config, tmp_pa "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -1447,7 +1474,10 @@ def test_run_app_test_mode(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -1566,7 +1596,10 @@ def test_run_app_test_mode_with_passthrough(run_command, first_app_config, tmp_p "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( @@ -1677,7 +1710,10 @@ def test_run_app_debugger(run_command, first_app_generated, tmp_path, dummy_debu "sys_path_regex": "app_packages$", "host_folder": str( tmp_path - / "base_path/build/first-app/ios/xcode/app_packages.iphonesimulator" + / ( + "base_path/build/first-app/ios/xcode/" + "app_packages.iphonesimulator" + ) ), }, } @@ -1730,7 +1766,10 @@ def test_run_app_debugger(run_command, first_app_generated, tmp_path, dummy_debu "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / "base_path/build/first-app/ios/xcode/build/Debug-iphonesimulator/First App.app", + / ( + "base_path/build/first-app/ios/xcode/build/" + "Debug-iphonesimulator/First App.app" + ), ], ), mock.call( diff --git a/tests/platforms/linux/appimage/test_build.py b/tests/platforms/linux/appimage/test_build.py index a8e2d2a0d0..0b02e55d7d 100644 --- a/tests/platforms/linux/appimage/test_build.py +++ b/tests/platforms/linux/appimage/test_build.py @@ -51,7 +51,8 @@ def build_command(dummy_console, tmp_path, first_app_config): command.use_docker = False command.extra_docker_build_args = [] - # Reset `os` mock without `spec` so tests can run on Windows where os.getuid doesn't exist. + # Reset `os` mock without `spec` + # so tests can run on Windows where os.getuid doesn't exist. command.tools.os = mock.MagicMock() # Mock user and group IDs for docker image command.tools.os.environ = mock.MagicMock() @@ -232,7 +233,10 @@ def test_build_appimage_with_plugin(build_command, first_app, tmp_path, sub_stre "something", ], env={ - "PATH": f"{gtk_plugin_path.parent}:{app_dir.parent}:/usr/local/bin:/usr/bin:/path/to/somewhere", + "PATH": ( + f"{gtk_plugin_path.parent}:{app_dir.parent}:" + "/usr/local/bin:/usr/bin:/path/to/somewhere" + ), "DEPLOY_GTK_VERSION": "3", "LINUXDEPLOY_OUTPUT_VERSION": "0.0.1", "DISABLE_COPYRIGHT_FILES_DEPLOYMENT": "1", diff --git a/tests/platforms/linux/appimage/test_run.py b/tests/platforms/linux/appimage/test_run.py index 9e02629fd3..51781ef6dc 100644 --- a/tests/platforms/linux/appimage/test_run.py +++ b/tests/platforms/linux/appimage/test_run.py @@ -89,7 +89,10 @@ def test_run_gui_app_with_passthrough(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / "base_path/build/first-app/linux/appimage/First_App-0.0.1-x86_64.AppImage", + / ( + "base_path/build/first-app/linux/appimage/" + "First_App-0.0.1-x86_64.AppImage" + ), "foo", "--bar", ], @@ -169,7 +172,10 @@ def test_run_console_app_with_passthrough(run_command, first_app_config, tmp_pat run_command.tools.subprocess.run.assert_called_with( [ tmp_path - / "base_path/build/first-app/linux/appimage/First_App-0.0.1-x86_64.AppImage", + / ( + "base_path/build/first-app/linux/appimage/" + "First_App-0.0.1-x86_64.AppImage" + ), "foo", "--bar", ], @@ -268,7 +274,10 @@ def test_run_app_test_mode_with_args( run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / "base_path/build/first-app/linux/appimage/First_App-0.0.1-x86_64.AppImage", + / ( + "base_path/build/first-app/linux/appimage/" + "First_App-0.0.1-x86_64.AppImage" + ), "foo", "--bar", ], diff --git a/tests/platforms/linux/flatpak/test_build.py b/tests/platforms/linux/flatpak/test_build.py index 39c53c3555..970ce5efa4 100644 --- a/tests/platforms/linux/flatpak/test_build.py +++ b/tests/platforms/linux/flatpak/test_build.py @@ -85,7 +85,10 @@ def test_missing_runtime_config(build_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match="Briefcase configuration error: The App does not specify the Flatpak runtime to use", + match=( + "Briefcase configuration error: " + "The App does not specify the Flatpak runtime to use" + ), ): build_command.build_app(first_app_config) @@ -105,6 +108,9 @@ def test_missing_base_version_config(build_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match=r"Briefcase configuration error: The App specifies a Flatpak base without a version.", + match=( + r"Briefcase configuration error: " + r"The App specifies a Flatpak base without a version." + ), ): build_command.build_app(first_app_config) diff --git a/tests/platforms/linux/flatpak/test_create.py b/tests/platforms/linux/flatpak/test_create.py index d695c3da87..b83b2532c2 100644 --- a/tests/platforms/linux/flatpak/test_create.py +++ b/tests/platforms/linux/flatpak/test_create.py @@ -246,6 +246,9 @@ def test_missing_runtime_config(create_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match="Briefcase configuration error: The App does not specify the Flatpak runtime to use", + match=( + "Briefcase configuration error: " + "The App does not specify the Flatpak runtime to use" + ), ): create_command.output_format_template_context(first_app_config) diff --git a/tests/platforms/linux/flatpak/test_mixin.py b/tests/platforms/linux/flatpak/test_mixin.py index 4b3f2c2b38..59b4025c75 100644 --- a/tests/platforms/linux/flatpak/test_mixin.py +++ b/tests/platforms/linux/flatpak/test_mixin.py @@ -97,7 +97,10 @@ def test_missing_runtime(create_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match="Briefcase configuration error: The App does not specify the Flatpak runtime to use", + match=( + "Briefcase configuration error: " + "The App does not specify the Flatpak runtime to use" + ), ): create_command.flatpak_runtime(first_app_config) @@ -109,7 +112,10 @@ def test_missing_sdk(create_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match="Briefcase configuration error: The App does not specify the Flatpak SDK to use", + match=( + "Briefcase configuration error: " + "The App does not specify the Flatpak SDK to use" + ), ): create_command.flatpak_sdk(first_app_config) @@ -121,7 +127,10 @@ def test_missing_runtime_version(create_command, first_app_config): with pytest.raises( BriefcaseConfigError, - match="Briefcase configuration error: The App does not specify the version of the Flatpak runtime to use", + match=( + "Briefcase configuration error: " + "The App does not specify the version of the Flatpak runtime to use" + ), ): create_command.flatpak_runtime_version(first_app_config) diff --git a/tests/platforms/linux/system/test_create.py b/tests/platforms/linux/system/test_create.py index dfb95abaf9..bdb2e5ce56 100644 --- a/tests/platforms/linux/system/test_create.py +++ b/tests/platforms/linux/system/test_create.py @@ -41,7 +41,10 @@ def test_unsupported_host_os_with_docker(create_command, host_os, tmp_path): with pytest.raises( UnsupportedHostError, - match=r"Linux system projects can only be built on Linux, or on macOS using Docker\.", + match=( + r"Linux system projects can only be built " + r"on Linux, or on macOS using Docker\." + ), ): create_command() @@ -54,7 +57,10 @@ def test_unsupported_host_os_without_docker(create_command, host_os, tmp_path): with pytest.raises( UnsupportedHostError, - match=r"Linux system projects can only be built on Linux, or on macOS using Docker\.", + match=( + r"Linux system projects can only be built " + r"on Linux, or on macOS using Docker\." + ), ): create_command() @@ -130,7 +136,8 @@ def test_output_format_template_context( def test_output_format_template_context_no_docker(create_command, first_app_config): """If not using Docker, `use_non_root_user` default in template is used.""" - # Mock the host to Linux to avoid flagging any "always use non-root user on macOS" logic. + # Mock the host to Linux to avoid flagging + # any "always use non-root user on macOS" logic. create_command.tools.host_os = "Linux" # Add some properties defined in config finalization diff --git a/tests/platforms/linux/system/test_mixin__finalize_app_config.py b/tests/platforms/linux/system/test_mixin__finalize_app_config.py index d8c38ab08d..bd6e0ea377 100644 --- a/tests/platforms/linux/system/test_mixin__finalize_app_config.py +++ b/tests/platforms/linux/system/test_mixin__finalize_app_config.py @@ -80,7 +80,10 @@ def test_nodocker_non_freedesktop(create_command, first_app_config, tmp_path): # Finalize the app config with pytest.raises( BriefcaseCommandError, - match=r"Could not find the /etc/os-release file. Is this a FreeDesktop-compliant Linux distribution\?", + match=( + r"Could not find the /etc/os-release file. " + r"Is this a FreeDesktop-compliant Linux distribution\?" + ), ): create_command.finalize_app_config(first_app_config) @@ -171,7 +174,8 @@ def test_docker_arch_without_user_mapping(create_command, first_app_config, tmp_ def test_properties(create_command, first_app_config): """The final app config is the result of merging target properties, plus other derived properties.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -247,7 +251,8 @@ def test_properties(create_command, first_app_config): def test_properties_unknown_basevendor(create_command, first_app_config): """If the base vendor can't be identified, the merge still succeeds.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -308,7 +313,8 @@ def test_properties_unknown_basevendor(create_command, first_app_config): def test_properties_no_basevendor_config(create_command, first_app_config): """If there's no basevendor config, the merge still succeeds.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -370,7 +376,8 @@ def test_properties_no_basevendor_config(create_command, first_app_config): def test_properties_no_vendor(create_command, first_app_config): """If there's no vendor-specific config, the merge succeeds.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -422,7 +429,8 @@ def test_properties_no_vendor(create_command, first_app_config): def test_properties_no_version(create_command, first_app_config): """If there's no version-specific config, the merge succeeds.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -520,7 +528,8 @@ def test_passive_mixin(dummy_console, first_app_config, tmp_path): def test_cascading_distribution_properties(create_command, first_app_config): """Properties should be cascading/accumulating, and vendor-level properties should overwrite os-level ones when in a dictionary.""" - # Run this test as "docker"; however, the things we're testing aren't docker specific. + # Run this test as "docker"; however, + # the things we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") diff --git a/tests/platforms/linux/system/test_mixin__properties.py b/tests/platforms/linux/system/test_mixin__properties.py index c35bea85be..fe2a313300 100644 --- a/tests/platforms/linux/system/test_mixin__properties.py +++ b/tests/platforms/linux/system/test_mixin__properties.py @@ -63,10 +63,9 @@ def test_binary_path(create_command, first_app_config, tmp_path): first_app_config.target_vendor = "somevendor" first_app_config.target_codename = "surprising" - assert ( - create_command.binary_path(first_app_config) - == tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + assert create_command.binary_path(first_app_config) == tmp_path / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" ) @@ -117,7 +116,10 @@ def test_distribution_path_unknown(create_command, first_app_config, tmp_path): with pytest.raises( BriefcaseCommandError, - match=r"Briefcase doesn't currently know how to build system packages in UNKNOWN format.", + match=( + r"Briefcase doesn't currently know " + r"how to build system packages in UNKNOWN format." + ), ): create_command.distribution_path(first_app_config) diff --git a/tests/platforms/linux/system/test_package.py b/tests/platforms/linux/system/test_package.py index b0ef1c06b8..4cfa871639 100644 --- a/tests/platforms/linux/system/test_package.py +++ b/tests/platforms/linux/system/test_package.py @@ -220,6 +220,9 @@ def test_package_unknown_format(package_command, first_app): # Package the app with pytest.raises( BriefcaseCommandError, - match=r"Briefcase doesn't currently know how to build system packages in UNKNOWN format.", + match=( + r"Briefcase doesn't currently know " + r"how to build system packages in UNKNOWN format." + ), ): package_command.package_app(first_app) diff --git a/tests/platforms/linux/system/test_package__deb.py b/tests/platforms/linux/system/test_package__deb.py index 745fc40cc3..b1f8385768 100644 --- a/tests/platforms/linux/system/test_package__deb.py +++ b/tests/platforms/linux/system/test_package__deb.py @@ -322,7 +322,10 @@ def test_deb_package_no_long_description(package_command, first_app_deb, tmp_pat # Packaging the app will fail with pytest.raises( BriefcaseCommandError, - match=r"App configuration does not define `long_description`. Debian projects require a long description.", + match=( + r"App configuration does not define `long_description`. " + r"Debian projects require a long description." + ), ): package_command.package_app(first_app_deb) diff --git a/tests/platforms/linux/system/test_package__pkg.py b/tests/platforms/linux/system/test_package__pkg.py index 1b474c403e..2efedd70b0 100644 --- a/tests/platforms/linux/system/test_package__pkg.py +++ b/tests/platforms/linux/system/test_package__pkg.py @@ -169,7 +169,8 @@ def test_pkg_package(package_command, first_app_pkg, tmp_path, changelog_filenam """A pkg app can be packaged.""" bundle_path = tmp_path / "base_path/build/first-app/somevendor/surprising" - # Remove CHANGELOG made in conftest.py and replace with another possible changelog format + # Remove CHANGELOG made in conftest.py and + # replace with another possible changelog format base_path = tmp_path / "base_path" old_changelog = base_path / "CHANGELOG" new_changelog = base_path / changelog_filename @@ -364,7 +365,10 @@ def test_pkg_package_no_description(package_command, first_app_pkg, tmp_path): # Packaging the app will fail with pytest.raises( BriefcaseCommandError, - match=r"App configuration does not define `description`. Arch projects require a description.", + match=( + r"App configuration does not define `description`. " + r"Arch projects require a description." + ), ): package_command.package_app(first_app_pkg) @@ -499,7 +503,8 @@ def test_no_changelog(package_command, first_app_pkg, tmp_path): # The CHANGELOG file will not be copied assert not (bundle_path / "pkgbuild/CHANGELOG").exists() - # The PKGBUILD file will not exist (as existence of changelog is checked before writing the PKGBUILD file) + # The PKGBUILD file will not exist + # (as existence of changelog is checked before writing the PKGBUILD file) assert not (bundle_path / "pkgbuild/PKGBUILD").exists() # No source tarball was created diff --git a/tests/platforms/linux/system/test_package__rpm.py b/tests/platforms/linux/system/test_package__rpm.py index 5adb174ad0..eca0083ed5 100644 --- a/tests/platforms/linux/system/test_package__rpm.py +++ b/tests/platforms/linux/system/test_package__rpm.py @@ -169,7 +169,8 @@ def test_rpm_package(package_command, first_app_rpm, tmp_path, changelog_filenam """A rpm app can be packaged.""" bundle_path = tmp_path / "base_path/build/first-app/somevendor/surprising" - # Remove CHANGELOG made in conftest.py and replace with another possible changelog format + # Remove CHANGELOG made in conftest.py and + # replace with another possible changelog format base_path = tmp_path / "base_path" old_changelog = base_path / "CHANGELOG" new_changelog = base_path / changelog_filename @@ -460,7 +461,10 @@ def test_rpm_package_no_long_description(package_command, first_app_rpm, tmp_pat # Packaging the app will fail with pytest.raises( BriefcaseCommandError, - match=r"App configuration does not define `long_description`. Red Hat projects require a long description.", + match=( + r"App configuration does not define `long_description`. " + r"Red Hat projects require a long description." + ), ): package_command.package_app(first_app_rpm) diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index 5ceea0762d..6e5b03c060 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -139,7 +139,8 @@ def test_supported_host_os(run_command, first_app, sub_kw, tmp_path): # The process was started run_command.tools.subprocess._subprocess.Popen.assert_called_with( [ - f"{tmp_path / 'base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app'}" + f"{tmp_path / 'base_path/build/first-app/somevendor'}" + "/surprising/first-app-0.0.1/usr/bin/first-app" ], cwd=f"{tmp_path / 'home'}", stdout=subprocess.PIPE, @@ -250,7 +251,10 @@ def test_run_gui_app(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ) ], cwd=os.fsdecode(tmp_path / "home"), @@ -289,7 +293,10 @@ def test_run_gui_app_passthrough(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ), "foo", "--bar", @@ -330,7 +337,10 @@ def test_run_gui_app_failed(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ) ], cwd=os.fsdecode(tmp_path / "home"), @@ -359,7 +369,10 @@ def test_run_console_app(run_command, first_app, tmp_path): mock.call( [ tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ], cwd=tmp_path / "home", bufsize=1, @@ -388,7 +401,10 @@ def test_run_console_app_passthrough(run_command, first_app, tmp_path): mock.call( [ tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app", + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ), "foo", "--bar", ], @@ -420,7 +436,10 @@ def test_run_console_app_failed(run_command, first_app, sub_kw, tmp_path): mock.call( [ tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ], cwd=tmp_path / "home", bufsize=1, @@ -583,14 +602,20 @@ def test_run_app_test_mode( [ os.fsdecode( tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ) ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, - env={"ENVVAR": "Value", "BRIEFCASE_MAIN_MODULE": "tests.first_app"}, + env={ + "ENVVAR": "Value", + "BRIEFCASE_MAIN_MODULE": "tests.first_app", + }, **sub_kw, ) @@ -712,7 +737,10 @@ def test_run_app_test_mode_with_args( [ os.fsdecode( tmp_path - / "base_path/build/first-app/somevendor/surprising/first-app-0.0.1/usr/bin/first-app" + / ( + "base_path/build/first-app/somevendor/" + "surprising/first-app-0.0.1/usr/bin/first-app" + ) ), "foo", "--bar", @@ -721,7 +749,10 @@ def test_run_app_test_mode_with_args( stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, - env={"ENVVAR": "Value", "BRIEFCASE_MAIN_MODULE": "tests.first_app"}, + env={ + "ENVVAR": "Value", + "BRIEFCASE_MAIN_MODULE": "tests.first_app", + }, **sub_kw, ) diff --git a/tests/platforms/linux/test_LocalRequirementsMixin.py b/tests/platforms/linux/test_LocalRequirementsMixin.py index aa3a8c3f64..d4f2613fd9 100644 --- a/tests/platforms/linux/test_LocalRequirementsMixin.py +++ b/tests/platforms/linux/test_LocalRequirementsMixin.py @@ -448,7 +448,8 @@ def test_install_app_requirements_with_bad_local( # pip was *not* invoked inside docker. create_command.tools.subprocess.run.assert_not_called() - # The local requirements path exists, and is empty. It has been purged, but not refilled. + # The local requirements path exists, and is empty. + # It has been purged, but not refilled. local_requirements_path = create_command.local_requirements_path(first_app_config) assert local_requirements_path.exists() assert len(list(local_requirements_path.iterdir())) == 0 @@ -482,7 +483,8 @@ def test_install_app_requirements_with_missing_local_build( # pip was *not* invoked inside docker. create_command.tools.subprocess.run.assert_not_called() - # The local requirements path exists, and is empty. It has been purged, but not refilled. + # The local requirements path exists, and is empty. + # It has been purged, but not refilled. local_requirements_path = create_command.local_requirements_path(first_app_config) assert local_requirements_path.exists() assert len(list(local_requirements_path.iterdir())) == 0 @@ -522,7 +524,8 @@ def test_install_app_requirements_with_bad_local_file( # pip was *not* invoked inside docker. create_command.tools.subprocess.run.assert_not_called() - # The local requirements path exists, and is empty. It has been purged, but not refilled. + # The local requirements path exists, and is empty. + # It has been purged, but not refilled. local_requirements_path = create_command.local_requirements_path(first_app_config) assert local_requirements_path.exists() assert len(list(local_requirements_path.iterdir())) == 0 diff --git a/tests/platforms/macOS/app/package/test_ditto.py b/tests/platforms/macOS/app/package/test_ditto.py index c5f5d60cc9..2082048711 100644 --- a/tests/platforms/macOS/app/package/test_ditto.py +++ b/tests/platforms/macOS/app/package/test_ditto.py @@ -36,7 +36,8 @@ def test_ditto( # The archive contains the app as the only top level element. with ZipFile(archive_path) as archive: - # zip file can include a “__MACOSX” folder for each document that contains information about + # zip file can include a “__MACOSX” folder for + # each document that contains information about # the file useful for Finder and will not be in the unzipped set of files archived_files = [ fn for fn in archive.namelist() if not fn.startswith("__MACOSX/") @@ -49,22 +50,31 @@ def test_ditto( "First App.app/Contents/Frameworks/Extras.framework/", "First App.app/Contents/Frameworks/Extras.framework/Extras", "First App.app/Contents/Frameworks/Extras.framework/Resources/", - "First App.app/Contents/Frameworks/Extras.framework/Resources/Info.plist", + ("First App.app/Contents/Frameworks/Extras.framework/Resources/Info.plist"), "First App.app/Contents/Frameworks/Extras.framework/Versions/", - "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/", - "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/Extras", - "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/libs/", - "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/libs/extras.dylib", - "First App.app/Contents/Frameworks/Extras.framework/Versions/Current", + ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/"), + ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/Extras"), + ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/libs/"), + ( + "First App.app/Contents/Frameworks/Extras.framework/" + "Versions/1.2/libs/extras.dylib" + ), + ("First App.app/Contents/Frameworks/Extras.framework/Versions/Current"), "First App.app/Contents/Info.plist", "First App.app/Contents/MacOS/", "First App.app/Contents/MacOS/First App", "First App.app/Contents/Resources/", "First App.app/Contents/Resources/app_packages/", "First App.app/Contents/Resources/app_packages/Extras.app/", - "First App.app/Contents/Resources/app_packages/Extras.app/Contents/", - "First App.app/Contents/Resources/app_packages/Extras.app/Contents/MacOS/", - "First App.app/Contents/Resources/app_packages/Extras.app/Contents/MacOS/Extras", + ("First App.app/Contents/Resources/app_packages/Extras.app/Contents/"), + ( + "First App.app/Contents/Resources/app_packages/Extras.app/" + "Contents/MacOS/" + ), + ( + "First App.app/Contents/Resources/app_packages/Extras.app/" + "Contents/MacOS/Extras" + ), "First App.app/Contents/Resources/app_packages/first.other", "First App.app/Contents/Resources/app_packages/first_dylib.dylib", "First App.app/Contents/Resources/app_packages/first_so.so", @@ -72,8 +82,11 @@ def test_ditto( "First App.app/Contents/Resources/app_packages/second.other", "First App.app/Contents/Resources/app_packages/special.binary", "First App.app/Contents/Resources/app_packages/subfolder/", - "First App.app/Contents/Resources/app_packages/subfolder/second_dylib.dylib", - "First App.app/Contents/Resources/app_packages/subfolder/second_so.so", + ( + "First App.app/Contents/Resources/app_packages/subfolder/" + "second_dylib.dylib" + ), + ("First App.app/Contents/Resources/app_packages/subfolder/second_so.so"), "First App.app/Contents/Resources/app_packages/unknown.binary", ] diff --git a/tests/platforms/macOS/app/package/test_notarize.py b/tests/platforms/macOS/app/package/test_notarize.py index f045e65e56..e16cc7990a 100644 --- a/tests/platforms/macOS/app/package/test_notarize.py +++ b/tests/platforms/macOS/app/package/test_notarize.py @@ -99,7 +99,8 @@ def test_notarize_app( # As a result of mocking ditto, the zip archive won't *actually* be created; # and as a result of mocking os, it won't *actually* be deleted either - but we can - # verify that it *would* have been deleted. ditto will also be called when finalizing, + # verify that it *would* have been deleted. + # ditto will also be called when finalizing, # to create the actual distribution artefact. assert package_command.ditto_archive.mock_calls == [ mock.call(app_path, archive_path), @@ -730,7 +731,10 @@ def test_credential_storage_disabled_input_app( # The notarization call will fail with an error with pytest.raises( BriefcaseCommandError, - match=r"The keychain does not contain credentials for the profile briefcase-macOS-DEADBEEF.", + match=( + r"The keychain does not contain credentials " + r"for the profile briefcase-macOS-DEADBEEF." + ), ): package_command.notarize(first_app_zip, identity=sekrit_identity) @@ -795,7 +799,10 @@ def test_credential_storage_disabled_input_dmg( # The notarization call will fail with an error with pytest.raises( BriefcaseCommandError, - match=r"The keychain does not contain credentials for the profile briefcase-macOS-DEADBEEF.", + match=( + r"The keychain does not contain credentials " + r"for the profile briefcase-macOS-DEADBEEF." + ), ): package_command.notarize(first_app_dmg, identity=sekrit_identity) @@ -941,7 +948,10 @@ def test_app_submit_notarization_failure_with_credentials( # The notarization call will fail with an error with pytest.raises( BriefcaseCommandError, - match=r"Unable to submit build[/\\]first-app[/\\]macos[/\\]app[/\\]First App.app for notarization.", + match=( + r"Unable to submit build[/\\]first-app[/\\]" + r"macos[/\\]app[/\\]First App.app for notarization." + ), ): package_command.notarize(first_app_zip, identity=sekrit_identity) diff --git a/tests/platforms/macOS/app/package/test_package.py b/tests/platforms/macOS/app/package/test_package.py index cdca1341a9..b0babbce9b 100644 --- a/tests/platforms/macOS/app/package/test_package.py +++ b/tests/platforms/macOS/app/package/test_package.py @@ -456,7 +456,8 @@ def test_notarize_adhoc_signed_via_prompt( package_command.select_identity.return_value = adhoc_identity - # Package the app without code signing. Use the base command's interface to ensure the full + # Package the app without code signing. + # Use the base command's interface to ensure the full # cleanup process is tested. with pytest.raises( BriefcaseCommandError, diff --git a/tests/platforms/macOS/app/package/test_resume_notarization.py b/tests/platforms/macOS/app/package/test_resume_notarization.py index 60dda24fa0..dd37e77dbf 100644 --- a/tests/platforms/macOS/app/package/test_resume_notarization.py +++ b/tests/platforms/macOS/app/package/test_resume_notarization.py @@ -295,7 +295,8 @@ def test_resume_notarize_pkg( "distribution file", ) - # 2 calls are made to determine identity - the app identity, then the installer identity. + # 2 calls are made to determine identity - + # the app identity, then the installer identity. package_command.select_identity.side_effect = [ sekrit_identity, sekrit_installer_identity, @@ -344,7 +345,8 @@ def test_resume_notarize_pkg( submission_id=submission_id, ) - # Identity selection excluded adhoc identities, but also confirmed notarization identity + # Identity selection excluded adhoc identities, + # but also confirmed notarization identity assert package_command.select_identity.mock_calls == [ mock.call( identity=sekrit_identity.id, @@ -550,7 +552,8 @@ def test_resume_notarize_from_marker( packaging_format=packaging_format, ) - # Identity selection excluded adhoc identities; PKG also resolves an installer identity. + # Identity selection excluded adhoc identities; + # PKG also resolves an installer identity. if use_installer: assert package_command.select_identity.mock_calls == [ mock.call( @@ -813,7 +816,8 @@ def test_resume_notarize_from_marker_rejected( # The marker exists on disk, ready to be auto-detected. assert marker_path.exists() - # Resume notarization. The marker is auto-detected, but the notarization is rejected. + # Resume notarization. + # The marker is auto-detected, but the notarization is rejected. with pytest.raises( BriefcaseCommandError, match=r"Notarization was rejected: Bad mojo", diff --git a/tests/platforms/macOS/app/test_build.py b/tests/platforms/macOS/app/test_build.py index 9aa3af6755..3733aa2d8d 100644 --- a/tests/platforms/macOS/app/test_build.py +++ b/tests/platforms/macOS/app/test_build.py @@ -73,7 +73,8 @@ def test_build_app( arch="gothic", ) - # Verify that a request has been made to sign the app, but only when it is as part of a direct build command + # Verify that a request has been made to sign the app, + # but only when it is as part of a direct build command if "adhoc_sign" in kwargs: # build command was called as part of package command. # expect no signing now since it will happen during packaging diff --git a/tests/platforms/macOS/app/test_create.py b/tests/platforms/macOS/app/test_create.py index 6a80e81542..84b290d17e 100644 --- a/tests/platforms/macOS/app/test_create.py +++ b/tests/platforms/macOS/app/test_create.py @@ -45,7 +45,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated { "info": {}, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, }, }, @@ -64,7 +64,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCustomPermission": "Custom message", }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, "com.apple.vm.networking": True, }, @@ -79,10 +79,12 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "info": { - "NSBluetoothAlwaysUsageDescription": "I need to connect to bluetooth device." + "NSBluetoothAlwaysUsageDescription": ( + "I need to connect to bluetooth device." + ) }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.bluetooth": True, }, @@ -100,7 +102,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCameraUsageDescription": "I need to see you", }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.camera": True, }, @@ -118,7 +120,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSMicrophoneUsageDescription": "I need to hear you", }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.microphone": True, }, @@ -127,18 +129,20 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Coarse location permissions ( { - "coarse_location": "I need to know roughly where you are", + "coarse_location": ("I need to know roughly where you are"), }, {}, {}, { "info": { - "NSLocationUsageDescription": "I need to know roughly where you are", + "NSLocationUsageDescription": ( + "I need to know roughly where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), @@ -151,49 +155,55 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "info": { - "NSLocationUsageDescription": "I need to know exactly where you are", + "NSLocationUsageDescription": ( + "I need to know exactly where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), # Background location permissions ( { - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, {}, { "info": { - "NSLocationUsageDescription": "I always need to know where you are", + "NSLocationUsageDescription": ( + "I always need to know where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), # Coarse location background permissions ( { - "coarse_location": "I need to know roughly where you are", - "background_location": "I always need to know where you are", + "coarse_location": ("I need to know roughly where you are"), + "background_location": ("I always need to know where you are"), }, {}, {}, { "info": { - "NSLocationUsageDescription": "I always need to know where you are", + "NSLocationUsageDescription": ( + "I always need to know where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), @@ -201,57 +211,63 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ( { "fine_location": "I need to know exactly where you are", - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, {}, { "info": { - "NSLocationUsageDescription": "I always need to know where you are", + "NSLocationUsageDescription": ( + "I always need to know where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), # Coarse and fine location permissions ( { - "coarse_location": "I need to know roughly where you are", + "coarse_location": ("I need to know roughly where you are"), "fine_location": "I need to know exactly where you are", }, {}, {}, { "info": { - "NSLocationUsageDescription": "I need to know exactly where you are", + "NSLocationUsageDescription": ( + "I need to know exactly where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), # Coarse and fine background location permissions ( { - "coarse_location": "I need to know roughly where you are", + "coarse_location": ("I need to know roughly where you are"), "fine_location": "I need to know exactly where you are", - "background_location": "I always need to know where you are", + "background_location": ("I always need to know where you are"), }, {}, {}, { "info": { - "NSLocationUsageDescription": "I always need to know where you are", + "NSLocationUsageDescription": ( + "I always need to know where you are" + ), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.location": True, + ("com.apple.security.personal-information.location"): True, }, }, ), @@ -264,12 +280,12 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "info": { - "NSPhotoLibraryUsageDescription": "I need to see your library", + "NSPhotoLibraryUsageDescription": ("I need to see your library"), }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": True, - "com.apple.security.personal-information.photo_library": True, + ("com.apple.security.personal-information.photo_library"): True, }, }, ), @@ -283,7 +299,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSLocationUsageDescription": "Platform specific", }, { - "com.apple.security.personal-information.location": False, + ("com.apple.security.personal-information.location"): False, "com.apple.security.cs.disable-library-validation": False, "com.apple.vm.networking": True, }, @@ -293,9 +309,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCustomMessage": "Custom message", }, "entitlements": { - "com.apple.security.cs.allow-unsigned-executable-memory": True, + ("com.apple.security.cs.allow-unsigned-executable-memory"): True, "com.apple.security.cs.disable-library-validation": False, - "com.apple.security.personal-information.location": False, + ("com.apple.security.personal-information.location"): False, "com.apple.vm.networking": True, }, }, @@ -340,7 +356,8 @@ def test_generate_app_template_formal_name_mismatch(create_command, first_app): with pytest.raises( BriefcaseCommandError, match=( - r"The app bundle referenced by external_package_path \(Unexpected Name.app\)\n" + r"The app bundle referenced by external_package_path " + r"\(Unexpected Name.app\)\n" r"does not match the formal name of the app \('First App'\)." ), ): @@ -1119,7 +1136,10 @@ def test_install_support_package( assert (bundle_path / "support/Python.xcframework/Info.plist").exists() assert ( bundle_path - / "support/Python.xcframework/macos-arm64_x86_64/Python.framework/Versions/Current/Python" + / ( + "support/Python.xcframework/macos-arm64_x86_64/" + "Python.framework/Versions/Current/Python" + ) ).is_file() assert ( bundle_path diff --git a/tests/platforms/macOS/app/test_signing.py b/tests/platforms/macOS/app/test_signing.py index a8b85dc387..c0dfb5b4a5 100644 --- a/tests/platforms/macOS/app/test_signing.py +++ b/tests/platforms/macOS/app/test_signing.py @@ -102,8 +102,12 @@ def test_explicit_app_identity_checksum(dummy_command): """If the user nominates an app identity by checksum, it is used.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # The identity will be the one the user specified as an option. @@ -122,8 +126,12 @@ def test_explicit_app_identity_name(dummy_command): """If the user nominates an app identity by name, it is used.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # The identity will be the one the user specified as an option. @@ -142,8 +150,12 @@ def test_invalid_app_identity_name(dummy_command): """If the user nominates an app identity by name, it is used.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # The identity will be the one the user specified as an option. @@ -159,7 +171,9 @@ def test_implied_app_identity(dummy_command): option.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # Return option 2 @@ -198,8 +212,12 @@ def test_select_app_identity(dummy_command): """The user can select from a list of app identities.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # Return option 3 @@ -221,8 +239,12 @@ def test_select_app_identity_no_adhoc(dummy_command): """Adhoc identities can be excluded from the list of options.""" # get_identities will return some options. dummy_command.get_identities.return_value = { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), } # Return option 2 @@ -244,17 +266,30 @@ def test_select_app_identity_no_adhoc(dummy_command): def test_select_installer_identity(dummy_command): """The user can select from a list of installer identities.""" - # get_identities is invoked twice - once with app identities, and once with all identities. + # get_identities is invoked twice - + # once with app identities, and once with all identities. dummy_command.get_identities.side_effect = [ { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), }, { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "4C1067833814CE4738EBD6F8903EC63C238B0CA3": "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", - "8903EC63C238B04C138EBD6F067833814CE47CA3": "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "4C1067833814CE4738EBD6F8903EC63C238B0CA3": ( + "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), + "8903EC63C238B04C138EBD6F067833814CE47CA3": ( + "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)" + ), }, ] @@ -281,26 +316,48 @@ def test_select_installer_identity(dummy_command): def test_installer_identity_matching_app(dummy_command): """The list of possible installer identities includes non-app identities from the same team.""" - # get_identities is invoked twice - once with app identities, and once with all identities. + # get_identities is invoked twice - + # once with app identities, and once with all identities. dummy_command.get_identities.side_effect = [ { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "EBD6F8903EC63C238B0384C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (83DLEZ2K43)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "EBD6F8903EC63C238B0384C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (83DLEZ2K43)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), }, { # The app identity that will be selected - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), # A different app identity - "EBD6F8903EC63C238B0384C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (83DLEZ2K43)", - # An installer identity that doesn't match the selected app identity - "1067833814CE4738EB4CD6F8903EC63C238B0CA3": "Developer ID Installer: Example Corp Ltd (83DLEZ2K43)", - # An installer identity that *does* match the selected app identity - "4C1067833814CE4738EBD6F8903EC63C238B0CA3": "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)", + "EBD6F8903EC63C238B0384C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (83DLEZ2K43)" + ), + # An installer identity that doesn't match + # the selected app identity + "1067833814CE4738EB4CD6F8903EC63C238B0CA3": ( + "Developer ID Installer: Example Corp Ltd (83DLEZ2K43)" + ), + # An installer identity that *does* match + # the selected app identity + "4C1067833814CE4738EBD6F8903EC63C238B0CA3": ( + "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)" + ), # A different app identity - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", - # Another installer identity that match the selected app identity - "8903EC63C238B04C138EBD6F067833814CE47CA3": "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)", + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), + # Another installer identity that match + # the selected app identity + "8903EC63C238B04C138EBD6F067833814CE47CA3": ( + "Developer ID Installer: Example Corp Ltd (Z2K4383DLE)" + ), }, ] @@ -328,22 +385,37 @@ def test_installer_identity_matching_app(dummy_command): def test_installer_identity_no_match(dummy_command): """The list of possible installer identities includes non-app identities from the same team.""" - # get_identities is invoked twice - once with app identities, and once with all identities. + # get_identities is invoked twice - + # once with app identities, and once with all identities. dummy_command.get_identities.side_effect = [ { - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", - "EBD6F8903EC63C238B0384C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (83DLEZ2K43)", - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), + "EBD6F8903EC63C238B0384C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (83DLEZ2K43)" + ), + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), }, { # The app identity that will be selected - "38EBD6F8903EC63C238B04C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (Z2K4383DLE)", + "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (Z2K4383DLE)" + ), # A different app identity - "EBD6F8903EC63C238B0384C1067833814CE47CA3": "Developer ID Application: Example Corp Ltd (83DLEZ2K43)", + "EBD6F8903EC63C238B0384C1067833814CE47CA3": ( + "Developer ID Application: Example Corp Ltd (83DLEZ2K43)" + ), # An installer identity that doesn't match the selected app identity - "1067833814CE4738EB4CD6F8903EC63C238B0CA3": "Developer ID Installer: Example Corp Ltd (83DLEZ2K43)", + "1067833814CE4738EB4CD6F8903EC63C238B0CA3": ( + "Developer ID Installer: Example Corp Ltd (83DLEZ2K43)" + ), # A different app identity - "11E77FB58F13F6108B38110D5D92233C58ED38C5": "iPhone Developer: Jane Smith (BXAH5H869S)", + "11E77FB58F13F6108B38110D5D92233C58ED38C5": ( + "iPhone Developer: Jane Smith (BXAH5H869S)" + ), }, ] diff --git a/tests/platforms/macOS/conftest.py b/tests/platforms/macOS/conftest.py index 5bb583e235..bfae01cf9d 100644 --- a/tests/platforms/macOS/conftest.py +++ b/tests/platforms/macOS/conftest.py @@ -77,7 +77,8 @@ def first_app_templated(first_app_config, tmp_path): """\n""", ) - # Create the XCframework Info.plist file, with a deliberately weird min macOS version + # Create the XCframework Info.plist file, + # with a deliberately weird min macOS version create_plist_file( ( tmp_path diff --git a/tests/platforms/macOS/test_SigningIdentity.py b/tests/platforms/macOS/test_SigningIdentity.py index e83831780d..b917a65c99 100644 --- a/tests/platforms/macOS/test_SigningIdentity.py +++ b/tests/platforms/macOS/test_SigningIdentity.py @@ -46,8 +46,8 @@ def test_adhoc_identity(): adhoc = SigningIdentity() assert adhoc.id == "-" assert ( - adhoc.name - == "Ad-hoc identity. The resulting package will run but cannot be re-distributed." + adhoc.name == "Ad-hoc identity. The resulting package will run " + "but cannot be re-distributed." ) assert adhoc.is_adhoc assert repr(adhoc) == "" diff --git a/tests/platforms/macOS/test_XcodeBuildFilter.py b/tests/platforms/macOS/test_XcodeBuildFilter.py index 9e1b659186..5a3881c8bf 100644 --- a/tests/platforms/macOS/test_XcodeBuildFilter.py +++ b/tests/platforms/macOS/test_XcodeBuildFilter.py @@ -25,30 +25,70 @@ ( [ "'Twas brillig, and the slithy toves", - '2023-09-27 08:38:11.865 xcodebuild[41087:25901835] DTDKRemoteDeviceConnection: Failed to start remote service "com.apple.mobile.notification_proxy" on device. Error: Error Domain=com.apple.dtdevicekit Code=811 "Failed to start remote service "com.apple.mobile.notification_proxy" on device." UserInfo={NSUnderlyingError=0x10b8ec780 {Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402653158 "The device is passcode protected." UserInfo={MobileDeviceErrorCode=(0xE800001A), com.apple.dtdevicekit.stacktrace=(', - " 0 DTDeviceKitBase 0x00000001288ff298 DTDKCreateNSErrorFromAMDErrorCode + 300", - " 1 DTDeviceKitBase 0x000000012890ba38 __63-[DTDKRemoteDeviceConnection startFirstServiceOf:unlockKeybag:]_block_invoke + 380", - " 2 DTDeviceKitBase 0x000000012890b248 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_4 + 28", - " 3 DTDeviceKitBase 0x0000000128901460 __DTDKExecuteInSession_block_invoke_2 + 68", - " 4 DTDeviceKitBase 0x0000000128900af0 __DTDKExecuteWithConnection_block_invoke_2 + 216", - " 5 DTDeviceKitBase 0x00000001289009e8 __DTDKExecuteWithConnection_block_invoke + 112", - " 6 libdispatch.dylib 0x00000001a81b4400 _dispatch_client_callout + 20", - " 7 libdispatch.dylib 0x00000001a81c397c _dispatch_lane_barrier_sync_invoke_and_complete + 56", - " 8 DVTFoundation 0x0000000100fa8014 DVTDispatchBarrierSync + 148", - " 9 DVTFoundation 0x0000000100f842b4 -[DVTDispatchLock performLockedBlock:] + 60", - " 10 DTDeviceKitBase 0x00000001289008e4 DTDKExecuteWithConnection + 200", - " 11 DTDeviceKitBase 0x00000001289012e4 DTDKExecuteInSession + 260", - " 12 DTDeviceKitBase 0x000000012890b028 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_2 + 204", - " 13 DVTFoundation 0x0000000100fa7330 __DVT_CALLING_CLIENT_BLOCK__ + 16", - " 14 DVTFoundation 0x0000000100fa7d58 __DVTDispatchAsync_block_invoke + 152", - " 15 libdispatch.dylib 0x00000001a81b2874 _dispatch_call_block_and_release + 32", - " 16 libdispatch.dylib 0x00000001a81b4400 _dispatch_client_callout + 20", - " 17 libdispatch.dylib 0x00000001a81bba88 _dispatch_lane_serial_drain + 668", - " 18 libdispatch.dylib 0x00000001a81bc62c _dispatch_lane_invoke + 436", - " 19 libdispatch.dylib 0x00000001a81c7244 _dispatch_workloop_worker_thread + 648", - " 20 libsystem_pthread.dylib 0x00000001a8360074 _pthread_wqthread + 288", - " 21 libsystem_pthread.dylib 0x00000001a835ed94 start_wqthread + 8", - '), DVTRadarComponentKey=261622, NSLocalizedDescription=The device is passcode protected.}}, NSLocalizedRecoverySuggestion=Please check your connection to your "device., DVTRadarComponentKey=261622, NSLocalizedDescription=Failed to start remote service "com.apple.mobile.notification_proxy" on device.}', + "2023-09-27 08:38:11.865 xcodebuild[41087:25901835] " + "DTDKRemoteDeviceConnection: Failed to start remote service " + '"com.apple.mobile.notification_proxy" on device. Error: Error ' + 'Domain=com.apple.dtdevicekit Code=811 "Failed to start remote ' + 'service "com.apple.mobile.notification_proxy" on device." ' + "UserInfo={NSUnderlyingError=0x10b8ec780 {Error " + "Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402653158 " + '"The device is passcode protected." ' + "UserInfo={MobileDeviceErrorCode=(0xE800001A), " + "com.apple.dtdevicekit.stacktrace=(", + " 0 DTDeviceKitBase " + "0x00000001288ff298 DTDKCreateNSErrorFromAMDErrorCode + 300", + " 1 DTDeviceKitBase " + "0x000000012890ba38 __63-[DTDKRemoteDeviceConnection " + "startFirstServiceOf:unlockKeybag:]_block_invoke + 380", + " 2 DTDeviceKitBase " + "0x000000012890b248 __48-[DTDKRemoteDeviceConnection " + "futureWithSession:]_block_invoke_4 + 28", + " 3 DTDeviceKitBase " + "0x0000000128901460 __DTDKExecuteInSession_block_invoke_2 + 68", + " 4 DTDeviceKitBase " + "0x0000000128900af0 __DTDKExecuteWithConnection_block_invoke_2 + 216", + " 5 DTDeviceKitBase " + "0x00000001289009e8 __DTDKExecuteWithConnection_block_invoke + 112", + " 6 libdispatch.dylib " + "0x00000001a81b4400 _dispatch_client_callout + 20", + " 7 libdispatch.dylib " + "0x00000001a81c397c " + "_dispatch_lane_barrier_sync_invoke_and_complete + 56", + " 8 DVTFoundation " + "0x0000000100fa8014 DVTDispatchBarrierSync + 148", + " 9 DVTFoundation " + "0x0000000100f842b4 -[DVTDispatchLock performLockedBlock:] + 60", + " 10 DTDeviceKitBase " + "0x00000001289008e4 DTDKExecuteWithConnection + 200", + " 11 DTDeviceKitBase " + "0x00000001289012e4 DTDKExecuteInSession + 260", + " 12 DTDeviceKitBase " + "0x000000012890b028 __48-[DTDKRemoteDeviceConnection " + "futureWithSession:]_block_invoke_2 + 204", + " 13 DVTFoundation " + "0x0000000100fa7330 __DVT_CALLING_CLIENT_BLOCK__ + 16", + " 14 DVTFoundation " + "0x0000000100fa7d58 __DVTDispatchAsync_block_invoke + 152", + " 15 libdispatch.dylib " + "0x00000001a81b2874 _dispatch_call_block_and_release + 32", + " 16 libdispatch.dylib " + "0x00000001a81b4400 _dispatch_client_callout + 20", + " 17 libdispatch.dylib " + "0x00000001a81bba88 _dispatch_lane_serial_drain + 668", + " 18 libdispatch.dylib " + "0x00000001a81bc62c _dispatch_lane_invoke + 436", + " 19 libdispatch.dylib " + "0x00000001a81c7244 _dispatch_workloop_worker_thread + 648", + " 20 libsystem_pthread.dylib " + "0x00000001a8360074 _pthread_wqthread + 288", + " 21 libsystem_pthread.dylib " + "0x00000001a835ed94 start_wqthread + 8", + "), DVTRadarComponentKey=261622, NSLocalizedDescription=The " + "device is passcode protected.}}, NSLocalizedRecoverySuggestion=" + 'Please check your connection to your "device., ' + "DVTRadarComponentKey=261622, NSLocalizedDescription=Failed to " + 'start remote service "com.apple.mobile.notification_proxy" ' + "on device.}", "Did gyre and gimble in the wabe;", ], [ @@ -60,7 +100,8 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-09-27 09:09:55.400 xcodebuild[44887:25948169] Failed to start service (com.apple.amfi.lockdown): 0xe800001a", + "2023-09-27 09:09:55.400 xcodebuild[44887:25948169] Failed to " + "start service (com.apple.amfi.lockdown): 0xe800001a", "Did gyre and gimble in the wabe;", ], [ @@ -72,7 +113,9 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-10-04 08:05:21.757 xcodebuild[46899:11335453] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)", + "2023-10-04 08:05:21.757 xcodebuild[46899:11335453] " + "DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled " + "set via user default (DVTEnableCoreDevice=disabled)", "Did gyre and gimble in the wabe;", ], [ @@ -84,11 +127,19 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-09-26 14:35:45.775 xcodebuild[75877:23947967] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103", - "Details: createItemModels creation requirements should not create capability item model for a capability item model that already exists.", + "2023-09-26 14:35:45.775 xcodebuild[75877:23947967] [MT] " + "DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/" + "BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/" + "com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/" + "IDEFoundation/Provisioning/Capabilities Infrastructure/" + "IDECapabilityQuerySelection.swift:103", + "Details: createItemModels creation requirements should not " + "create capability item model for a capability item model that " + "already exists.", "Function: createItemModels(for:itemModelSource:)", "Thread: <_NSMainThread: 0x11d60beb0>{number = 1, name = main}", - "Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.", + "Please file a bug at https://feedbackassistant.apple.com with " + "this warning message and any useful information you can provide.", "Did gyre and gimble in the wabe;", ], [ diff --git a/tests/platforms/macOS/test_macOSMixin_verify_tools.py b/tests/platforms/macOS/test_macOSMixin_verify_tools.py index 2fdb20fae9..0bbb9fd6d2 100644 --- a/tests/platforms/macOS/test_macOSMixin_verify_tools.py +++ b/tests/platforms/macOS/test_macOSMixin_verify_tools.py @@ -11,7 +11,8 @@ def test_verify_macos_cpu_arch(dummy_command): # Create a Mock object for the platform module dummy_command.tools.platform = MagicMock(spec_set=platform) - # Simulate that Mock platform is running on Apple Silicon with an x86_64 Python interpreter + # Simulate that Mock platform is running on Apple Silicon + # with an x86_64 Python interpreter dummy_command.tools.platform.machine = MagicMock(return_value="x86_64") dummy_command.tools.platform.version = MagicMock(return_value="ARM64") @@ -35,7 +36,8 @@ def test_verify_macos_cpu_arch_warning(monkeypatch, dummy_command, capsys): # Create a Mock object for the platform module dummy_command.tools.platform = MagicMock(spec_set=platform) - # Simulate that Mock platform is running on Apple Silicon with an x86_64 Python interpreter + # Simulate that Mock platform is running on Apple Silicon + # with an x86_64 Python interpreter dummy_command.tools.platform.machine = MagicMock(return_value="x86_64") dummy_command.tools.platform.version = MagicMock(return_value="ARM64") diff --git a/tests/platforms/macOS/test_macOS_log_clean_filter.py b/tests/platforms/macOS/test_macOS_log_clean_filter.py index 9a047910e0..68aee938e7 100644 --- a/tests/platforms/macOS/test_macOS_log_clean_filter.py +++ b/tests/platforms/macOS/test_macOS_log_clean_filter.py @@ -46,7 +46,8 @@ ), # macOS App log (std-nslog 1.*) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (libffi.dylib) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(libffi.dylib) Hello World!", ("Hello World!", True), ), # Empty macOS App log (std-nslog 1.*) @@ -56,7 +57,8 @@ ), # macOS App log (os_log shim) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_oslog_shim.abi3.so) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_oslog_shim.abi3.so) Hello World!", ("Hello World!", True), ), # Empty macOS App log (os_log shim) @@ -76,20 +78,24 @@ ), # iOS App log (old style .so libraries) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.so) Hello World!", ("Hello World!", True), ), ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.so) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-38-iphonesimulator.so) Hello World!", ("Hello World!", True), ), # iOS App log (old style .dylib libraries) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.dylib) Hello World!", ("Hello World!", True), ), ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.dylib) Hello World!", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-38-iphonesimulator.dylib) Hello World!", ("Hello World!", True), ), # iOS App log @@ -99,20 +105,24 @@ ), # Empty iOS App log (old style .so binaries) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) ", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.so) ", ("", True), ), ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.so) ", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-38-iphonesimulator.so) ", ("", True), ), # Empty iOS App log (old style .dylib binaries) ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) ", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.dylib) ", ("", True), ), ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.dylib) ", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-38-iphonesimulator.dylib) ", ("", True), ), # Empty iOS App log @@ -127,18 +137,21 @@ ), # Log content that contains square brackets ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (libffi.dylib) Test [1/5] ... OK", + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(libffi.dylib) Test [1/5] ... OK", ("Test [1/5] ... OK", True), ), # Log content that contains `.so` ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) " + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.so) " "A problem (foo.so) try to avoid it", ("A problem (foo.so) try to avoid it", True), ), # Log content that contains `.dylib` ( - "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) " + "2022-11-14 13:21:15.341 Df My App[59972:780a15] " + "(_ctypes.cpython-312-iphonesimulator.dylib) " "A problem (foo.dylib) try to avoid it", ("A problem (foo.dylib) try to avoid it", True), ), diff --git a/tests/platforms/macOS/xcode/test_mixin.py b/tests/platforms/macOS/xcode/test_mixin.py index 5e9de12776..965a560878 100644 --- a/tests/platforms/macOS/xcode/test_mixin.py +++ b/tests/platforms/macOS/xcode/test_mixin.py @@ -20,7 +20,10 @@ def test_unsupported_host_os(create_command, host_os): with pytest.raises( UnsupportedHostError, - match=r"macOS applications require the Xcode command line tools, which are only available on macOS\.", + match=( + r"macOS applications require the Xcode command line tools, " + r"which are only available on macOS\." + ), ): create_command() diff --git a/tests/platforms/web/static/test_build.py b/tests/platforms/web/static/test_build.py index b66d3d738f..4dcd410cb1 100644 --- a/tests/platforms/web/static/test_build.py +++ b/tests/platforms/web/static/test_build.py @@ -165,14 +165,18 @@ def mock_run(*args, **kwargs): " -------------------------------------------------->", ' ", "", - ' ', - ' ', + ' ', + ' ', " ", " ", " ", @@ -212,8 +216,10 @@ def mock_run(*args, **kwargs): "#pyconsole {", " display: None;", "}", - "/*******************************************************************", - "******************** Wheel contributed styles ********************/", + "/**************************************************" + "*****************", + "******************** Wheel contributed styles " + "********************/", "/*@@ css:start @@*/", "/**************************************************", " * dependency 1.2.3 (legacy static CSS: style.css)", @@ -303,7 +309,10 @@ def test_build_app_invalid_extra_pyscript_toml_content( # Building the web app raises an error with pytest.raises( BriefcaseConfigError, - match=r"Briefcase configuration error: Extra pyscript.toml content isn't valid TOML: Expected", + match=( + r"Briefcase configuration error: Extra pyscript.toml " + r"content isn't valid TOML: Expected" + ), ): build_command.build_app(first_app_generated) @@ -466,8 +475,10 @@ def mock_run(*args, **kwargs): "#pyconsole {", " display: None;", "}", - "/*******************************************************************", - "******************** Wheel contributed styles ********************/", + "/*******************************************************" + "************", + "******************** Wheel contributed styles " + "********************/", "/*@@ css:start @@*/", "/**************************************************", " * first_app 1.2.3 (legacy static CSS: style.css)", diff --git a/tests/platforms/web/static/test_build__process_wheel.py b/tests/platforms/web/static/test_build__process_wheel.py index 61a1535f28..2fadaed617 100644 --- a/tests/platforms/web/static/test_build__process_wheel.py +++ b/tests/platforms/web/static/test_build__process_wheel.py @@ -129,10 +129,10 @@ def test_process_wheel_legacy_css_warn_once(build_command, tmp_path, capsys): output = capsys.readouterr().out assert ( - "dummy-1.2.3-py3-none-any.whl: legacy '/static' CSS file dummy/static/one.css detected." - in output + "dummy-1.2.3-py3-none-any.whl: legacy '/static' " + "CSS file dummy/static/one.css detected." in output ) assert ( - "dummy-1.2.3-py3-none-any.whl: legacy '/static' CSS file dummy/static/two.css detected." - in output + "dummy-1.2.3-py3-none-any.whl: legacy '/static' " + "CSS file dummy/static/two.css detected." in output ) diff --git a/tests/platforms/web/static/test_build_extract_pyscript_config.py b/tests/platforms/web/static/test_build_extract_pyscript_config.py index 8eb51a2d3a..eb15877c4b 100644 --- a/tests/platforms/web/static/test_build_extract_pyscript_config.py +++ b/tests/platforms/web/static/test_build_extract_pyscript_config.py @@ -220,6 +220,9 @@ def test_extract_pyscript_config_invalid_wheel_pyscript_toml(build_command, tmp_ # Building the web app raises an error with pytest.raises( BriefcaseConfigError, - match=r"Briefcase configuration error: pyscript.toml content isn't valid TOML: Expected", + match=( + r"Briefcase configuration error: " + r"pyscript.toml content isn't valid TOML: Expected" + ), ): build_command.extract_pyscript_config([wheel_path]) diff --git a/tests/platforms/windows/app/create/test_create.py b/tests/platforms/windows/app/create/test_create.py index 9bc4e6cbb7..4064d20bf9 100644 --- a/tests/platforms/windows/app/create/test_create.py +++ b/tests/platforms/windows/app/create/test_create.py @@ -90,7 +90,8 @@ def test_verify_windows_cpu_arch(create_command): # Create a Mock object for the platform module create_command.tools.platform = MagicMock(spec_set=platform) - # Simulate that Mock platform is running on Windows ARM64 with an x86_64 Python interpreter + # Simulate that Mock platform is running on Windows ARM64 + # with an x86_64 Python interpreter create_command.tools.host_os = "Windows" create_command.tools.host_arch = "ARM64" create_command.tools.platform.python_compiler = MagicMock( @@ -117,7 +118,8 @@ def test_verify_windows_cpu_arch_warning(monkeypatch, create_command, capsys): # Create a Mock object for the platform module create_command.tools.platform = MagicMock(spec_set=platform) - # Simulate that Mock platform is running on Windows ARM64 with an x86_64 Python interpreter + # Simulate that Mock platform is running on Windows ARM64 + # with an x86_64 Python interpreter create_command.tools.host_os = "Windows" create_command.tools.host_arch = "ARM64" create_command.tools.platform.python_compiler = MagicMock( diff --git a/tests/platforms/windows/app/create/test_install_license.py b/tests/platforms/windows/app/create/test_install_license.py index bef42b9706..93a18bb92b 100644 --- a/tests/platforms/windows/app/create/test_install_license.py +++ b/tests/platforms/windows/app/create/test_install_license.py @@ -87,7 +87,10 @@ def test_license_file_multi_with_rtf_raises( raised.""" create_file( tmp_path / "base_path/LICENSE-A.rtf", - "{\\rtf1\\ansi\\deff0 {\\fonttbl {\\f0 Courier;}}Apache License text.\\par\\line}", + ( + "{\\rtf1\\ansi\\deff0 {\\fonttbl {\\f0 Courier;}}" + "Apache License text.\\par\\line}" + ), ) create_file(tmp_path / "base_path/LICENSE-B", "MIT License text") first_app_templated.license = "Apache-2.0 AND MIT" diff --git a/tests/platforms/windows/visualstudio/test_run.py b/tests/platforms/windows/visualstudio/test_run.py index 93d9a01651..ab691bd18b 100644 --- a/tests/platforms/windows/visualstudio/test_run.py +++ b/tests/platforms/windows/visualstudio/test_run.py @@ -75,7 +75,10 @@ def test_run_app_with_args(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / "base_path/build/first-app/windows/visualstudio/x64/Release/First App.exe", + / ( + "base_path/build/first-app/windows/" + "visualstudio/x64/Release/First App.exe" + ), "foo", "--bar", ], @@ -109,7 +112,10 @@ def test_run_app_test_mode(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / "base_path/build/first-app/windows/visualstudio/x64/Release/First App.exe" + / ( + "base_path/build/first-app/windows/" + "visualstudio/x64/Release/First App.exe" + ) ], cwd=tmp_path / "home", encoding="UTF-8", @@ -145,7 +151,10 @@ def test_run_app_test_mode_with_args(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / "base_path/build/first-app/windows/visualstudio/x64/Release/First App.exe", + / ( + "base_path/build/first-app/windows/" + "visualstudio/x64/Release/First App.exe" + ), "foo", "--bar", ], From efc4b301f01aab07c367a95b78542494477655a4 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Mon, 3 Aug 2026 16:35:29 +0630 Subject: [PATCH 03/15] fix: tests/integrations test_VisualStudio__verify wrong formatting --- pyproject.toml | 3 ++- tests/integrations/visualstudio/test_VisualStudio__verify.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67c432d697..53f27fc4f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -298,7 +298,8 @@ known-third-party = ["build"] [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes -"tests/integrations/*" = ["E501"] +# Note: Fixed +#"tests/integrations/*" = ["E501"] #"tests/platforms/*" = ["E501"] [tool.rumdl] diff --git a/tests/integrations/visualstudio/test_VisualStudio__verify.py b/tests/integrations/visualstudio/test_VisualStudio__verify.py index a6073fc0c1..634da44fa5 100644 --- a/tests/integrations/visualstudio/test_VisualStudio__verify.py +++ b/tests/integrations/visualstudio/test_VisualStudio__verify.py @@ -10,8 +10,7 @@ from briefcase.integrations.visualstudio import VisualStudio MSBUILD_OUTPUT = ( - "Microsoft (R) Build Engine version 17.2.1+52cd2da31 " - "for .NET Framework\n" + "Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework\n" "Copyright (C) Microsoft Corporation. All rights reserved.\n" "\n" "17.2.1.25201\n" @@ -263,7 +262,7 @@ def test_vswhere_bad_executable(mock_tools, vswhere_path): BriefcaseCommandError, match=( r"Visual Studio appears to exist, " - r"but Briefcase can't retrieve installation metadata.", + r"but Briefcase can't retrieve installation metadata." ), ): VisualStudio.verify(mock_tools) From 685c96e903c1cedc2d8da456a761f9fd2710e447 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Tue, 4 Aug 2026 22:06:22 +0630 Subject: [PATCH 04/15] feat: Add change note for issue #2383 --- changes/2383.misc.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/2383.misc.md diff --git a/changes/2383.misc.md b/changes/2383.misc.md new file mode 100644 index 0000000000..1972562f75 --- /dev/null +++ b/changes/2383.misc.md @@ -0,0 +1 @@ +Fixed E501 (line too long) violations in the `tests/integrations/` and `tests/platforms/` directories. From cd6af7bb63f5bccd248722182e58e289a144d046 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Tue, 4 Aug 2026 22:47:34 +0630 Subject: [PATCH 05/15] fix: pre-commit formatting failures --- .../platforms/macOS/test_XcodeBuildFilter.py | 220 +++++++++++------- 1 file changed, 140 insertions(+), 80 deletions(-) diff --git a/tests/platforms/macOS/test_XcodeBuildFilter.py b/tests/platforms/macOS/test_XcodeBuildFilter.py index 5a3881c8bf..57b0a7fc4d 100644 --- a/tests/platforms/macOS/test_XcodeBuildFilter.py +++ b/tests/platforms/macOS/test_XcodeBuildFilter.py @@ -25,70 +25,120 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-09-27 08:38:11.865 xcodebuild[41087:25901835] " - "DTDKRemoteDeviceConnection: Failed to start remote service " - '"com.apple.mobile.notification_proxy" on device. Error: Error ' - 'Domain=com.apple.dtdevicekit Code=811 "Failed to start remote ' - 'service "com.apple.mobile.notification_proxy" on device." ' - "UserInfo={NSUnderlyingError=0x10b8ec780 {Error " - "Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402653158 " - '"The device is passcode protected." ' - "UserInfo={MobileDeviceErrorCode=(0xE800001A), " - "com.apple.dtdevicekit.stacktrace=(", - " 0 DTDeviceKitBase " - "0x00000001288ff298 DTDKCreateNSErrorFromAMDErrorCode + 300", - " 1 DTDeviceKitBase " - "0x000000012890ba38 __63-[DTDKRemoteDeviceConnection " - "startFirstServiceOf:unlockKeybag:]_block_invoke + 380", - " 2 DTDeviceKitBase " - "0x000000012890b248 __48-[DTDKRemoteDeviceConnection " - "futureWithSession:]_block_invoke_4 + 28", - " 3 DTDeviceKitBase " - "0x0000000128901460 __DTDKExecuteInSession_block_invoke_2 + 68", - " 4 DTDeviceKitBase " - "0x0000000128900af0 __DTDKExecuteWithConnection_block_invoke_2 + 216", - " 5 DTDeviceKitBase " - "0x00000001289009e8 __DTDKExecuteWithConnection_block_invoke + 112", - " 6 libdispatch.dylib " - "0x00000001a81b4400 _dispatch_client_callout + 20", - " 7 libdispatch.dylib " - "0x00000001a81c397c " - "_dispatch_lane_barrier_sync_invoke_and_complete + 56", - " 8 DVTFoundation " - "0x0000000100fa8014 DVTDispatchBarrierSync + 148", - " 9 DVTFoundation " - "0x0000000100f842b4 -[DVTDispatchLock performLockedBlock:] + 60", - " 10 DTDeviceKitBase " - "0x00000001289008e4 DTDKExecuteWithConnection + 200", - " 11 DTDeviceKitBase " - "0x00000001289012e4 DTDKExecuteInSession + 260", - " 12 DTDeviceKitBase " - "0x000000012890b028 __48-[DTDKRemoteDeviceConnection " - "futureWithSession:]_block_invoke_2 + 204", - " 13 DVTFoundation " - "0x0000000100fa7330 __DVT_CALLING_CLIENT_BLOCK__ + 16", - " 14 DVTFoundation " - "0x0000000100fa7d58 __DVTDispatchAsync_block_invoke + 152", - " 15 libdispatch.dylib " - "0x00000001a81b2874 _dispatch_call_block_and_release + 32", - " 16 libdispatch.dylib " - "0x00000001a81b4400 _dispatch_client_callout + 20", - " 17 libdispatch.dylib " - "0x00000001a81bba88 _dispatch_lane_serial_drain + 668", - " 18 libdispatch.dylib " - "0x00000001a81bc62c _dispatch_lane_invoke + 436", - " 19 libdispatch.dylib " - "0x00000001a81c7244 _dispatch_workloop_worker_thread + 648", - " 20 libsystem_pthread.dylib " - "0x00000001a8360074 _pthread_wqthread + 288", - " 21 libsystem_pthread.dylib " - "0x00000001a835ed94 start_wqthread + 8", - "), DVTRadarComponentKey=261622, NSLocalizedDescription=The " - "device is passcode protected.}}, NSLocalizedRecoverySuggestion=" - 'Please check your connection to your "device., ' - "DVTRadarComponentKey=261622, NSLocalizedDescription=Failed to " - 'start remote service "com.apple.mobile.notification_proxy" ' - "on device.}", + ( + "2023-09-27 08:38:11.865 xcodebuild[41087:25901835] " + "DTDKRemoteDeviceConnection: Failed to start remote service " + '"com.apple.mobile.notification_proxy" on device. Error: Error ' + 'Domain=com.apple.dtdevicekit Code=811 "Failed to start remote ' + 'service "com.apple.mobile.notification_proxy" on device." ' + "UserInfo={NSUnderlyingError=0x10b8ec780 {Error " + "Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402653158 " + '"The device is passcode protected." ' + "UserInfo={MobileDeviceErrorCode=(0xE800001A), " + "com.apple.dtdevicekit.stacktrace=(" + ), + ( + " 0 DTDeviceKitBase " + "0x00000001288ff298 DTDKCreateNSErrorFromAMDErrorCode + 300" + ), + ( + " 1 DTDeviceKitBase " + "0x000000012890ba38 __63-[DTDKRemoteDeviceConnection " + "startFirstServiceOf:unlockKeybag:]_block_invoke + 380" + ), + ( + " 2 DTDeviceKitBase " + "0x000000012890b248 __48-[DTDKRemoteDeviceConnection " + "futureWithSession:]_block_invoke_4 + 28" + ), + ( + " 3 DTDeviceKitBase " + "0x0000000128901460 __DTDKExecuteInSession_block_invoke_2 + 68" + ), + ( + " 4 DTDeviceKitBase " + "0x0000000128900af0 " + "__DTDKExecuteWithConnection_block_invoke_2 + 216" + ), + ( + " 5 DTDeviceKitBase " + "0x00000001289009e8 " + "__DTDKExecuteWithConnection_block_invoke + 112" + ), + ( + " 6 libdispatch.dylib " + "0x00000001a81b4400 _dispatch_client_callout + 20" + ), + ( + " 7 libdispatch.dylib " + "0x00000001a81c397c " + "_dispatch_lane_barrier_sync_invoke_and_complete + 56" + ), + ( + " 8 DVTFoundation " + "0x0000000100fa8014 DVTDispatchBarrierSync + 148" + ), + ( + " 9 DVTFoundation " + "0x0000000100f842b4 -[DVTDispatchLock performLockedBlock:] + 60" + ), + ( + " 10 DTDeviceKitBase " + "0x00000001289008e4 DTDKExecuteWithConnection + 200" + ), + ( + " 11 DTDeviceKitBase " + "0x00000001289012e4 DTDKExecuteInSession + 260" + ), + ( + " 12 DTDeviceKitBase " + "0x000000012890b028 __48-[DTDKRemoteDeviceConnection " + "futureWithSession:]_block_invoke_2 + 204" + ), + ( + " 13 DVTFoundation " + "0x0000000100fa7330 __DVT_CALLING_CLIENT_BLOCK__ + 16" + ), + ( + " 14 DVTFoundation " + "0x0000000100fa7d58 __DVTDispatchAsync_block_invoke + 152" + ), + ( + " 15 libdispatch.dylib " + "0x00000001a81b2874 _dispatch_call_block_and_release + 32" + ), + ( + " 16 libdispatch.dylib " + "0x00000001a81b4400 _dispatch_client_callout + 20" + ), + ( + " 17 libdispatch.dylib " + "0x00000001a81bba88 _dispatch_lane_serial_drain + 668" + ), + ( + " 18 libdispatch.dylib " + "0x00000001a81bc62c _dispatch_lane_invoke + 436" + ), + ( + " 19 libdispatch.dylib " + "0x00000001a81c7244 _dispatch_workloop_worker_thread + 648" + ), + ( + " 20 libsystem_pthread.dylib " + "0x00000001a8360074 _pthread_wqthread + 288" + ), + ( + " 21 libsystem_pthread.dylib " + "0x00000001a835ed94 start_wqthread + 8" + ), + ( + "), DVTRadarComponentKey=261622, NSLocalizedDescription=The " + "device is passcode protected.}}, NSLocalizedRecoverySuggestion=" + 'Please check your connection to your "device., ' + "DVTRadarComponentKey=261622, NSLocalizedDescription=Failed to " + 'start remote service "com.apple.mobile.notification_proxy" ' + "on device.}" + ), "Did gyre and gimble in the wabe;", ], [ @@ -100,8 +150,10 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-09-27 09:09:55.400 xcodebuild[44887:25948169] Failed to " - "start service (com.apple.amfi.lockdown): 0xe800001a", + ( + "2023-09-27 09:09:55.400 xcodebuild[44887:25948169] Failed to " + "start service (com.apple.amfi.lockdown): 0xe800001a" + ), "Did gyre and gimble in the wabe;", ], [ @@ -113,9 +165,11 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-10-04 08:05:21.757 xcodebuild[46899:11335453] " - "DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled " - "set via user default (DVTEnableCoreDevice=disabled)", + ( + "2023-10-04 08:05:21.757 xcodebuild[46899:11335453] " + "DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled " + "set via user default (DVTEnableCoreDevice=disabled)" + ), "Did gyre and gimble in the wabe;", ], [ @@ -127,19 +181,25 @@ ( [ "'Twas brillig, and the slithy toves", - "2023-09-26 14:35:45.775 xcodebuild[75877:23947967] [MT] " - "DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/" - "BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/" - "com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/" - "IDEFoundation/Provisioning/Capabilities Infrastructure/" - "IDECapabilityQuerySelection.swift:103", - "Details: createItemModels creation requirements should not " - "create capability item model for a capability item model that " - "already exists.", + ( + "2023-09-26 14:35:45.775 xcodebuild[75877:23947967] [MT] " + "DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/" + "BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/" + "com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/" + "IDEFoundation/Provisioning/Capabilities Infrastructure/" + "IDECapabilityQuerySelection.swift:103" + ), + ( + "Details: createItemModels creation requirements should not " + "create capability item model for a capability item model that " + "already exists." + ), "Function: createItemModels(for:itemModelSource:)", "Thread: <_NSMainThread: 0x11d60beb0>{number = 1, name = main}", - "Please file a bug at https://feedbackassistant.apple.com with " - "this warning message and any useful information you can provide.", + ( + "Please file a bug at https://feedbackassistant.apple.com with " + "this warning message and any useful information you can provide." + ), "Did gyre and gimble in the wabe;", ], [ From 2c67cd6ad4d1883dcef60cf2e0bfad437b88dbd4 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 5 Aug 2026 09:49:18 +0630 Subject: [PATCH 06/15] fix: formatting errors [E501]mhsmith feedbacks --- .../integrations/android_sdk/ADB/test_run.py | 14 ++++---- .../AndroidSDK/test_list_installed_images.py | 3 +- .../AndroidSDK/test_start_emulator.py | 8 ++--- .../AndroidSDK/test_verify_system_image.py | 3 +- .../docker/test_Docker__x11_passthrough.py | 3 +- .../windows_sdk/test_WindowsSDK__verify.py | 1 - .../xcode/test_ensure_xcode_is_installed.py | 32 +++++++++---------- 7 files changed, 26 insertions(+), 38 deletions(-) diff --git a/tests/integrations/android_sdk/ADB/test_run.py b/tests/integrations/android_sdk/ADB/test_run.py index 084bdf9c8f..0154d888e2 100644 --- a/tests/integrations/android_sdk/ADB/test_run.py +++ b/tests/integrations/android_sdk/ADB/test_run.py @@ -1,7 +1,6 @@ import subprocess import sys from pathlib import Path -from textwrap import dedent import pytest @@ -91,13 +90,12 @@ def test_error_handling(mock_tools, adb, name, exception, tmp_path): def test_older_sdk_error(mock_tools, adb): """Failure [INSTALL_FAILED_OLDER_SDK] needs to be caught manually.""" - mock_tools.subprocess.check_output.return_value = dedent( - """\ - Performing Push Install - C:/.../app-debug.apk: 1 file pushed, 0 skipped. 5.5 MB/s """ - """(33125287 bytes in 5.768s) - pkg: /data/local/tmp/app-debug.apk - Failure [INSTALL_FAILED_OLDER_SDK]""" + mock_tools.subprocess.check_output.return_value = ( + "Performing Push Install\n" + "C:/.../app-debug.apk: 1 file pushed, 0 skipped. 5.5 MB/s " + "(33125287 bytes in 5.768s)\n" + " pkg: /data/local/tmp/app-debug.apk\n" + "Failure [INSTALL_FAILED_OLDER_SDK]" ) with pytest.raises( BriefcaseCommandError, diff --git a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py index f8f095f24b..ccd4dfcb18 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py @@ -15,8 +15,7 @@ def test_list_installed_system_images(mock_tools, android_sdk): " ------- | ------- | " "------- | -------\n" " system-images;android-31;default;x86_64 | 5 | " - "Intel x86_64 Atom System Image | " - "system-images/android-31/default/x86_64\n" + "Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" " emulator | 35.4.9 | " "Android Emulator | emulator\n" ) diff --git a/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py b/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py index 2dd5c8621b..cddbe80c19 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py @@ -375,19 +375,15 @@ def test_emulator_fail_to_boot(mock_tools, android_sdk): # 3 calls to avd_name and then 3 calls to getprop android_sdk.mock_run.side_effect = [ # emu avd_name - subprocess.CalledProcessError( - returncode=1, - cmd="emu avd name", - ), + subprocess.CalledProcessError(returncode=1, cmd="emu avd name"), "runningEmulator\nOK", "idleEmulator\nOK", # shell getprop sys.boot_completed "\n", # gets in to emulator has_booted() if block "\n", # enters has_booted() while loop "\n", # one loop waiting for simulator to finish booting - # successful boot...except poll() will return - # non-None first raising failure "1\n", + # successful boot...except poll() will return non-None first raising failure ] # poll() on the process returns failure during simulator boot diff --git a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py index 7ae6d24124..aa5a8ce7ac 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py @@ -92,8 +92,7 @@ def test_existing_system_image(mock_tools, android_sdk): " ------- | ------- | " "------- | -------\n" " system-images;android-31;default;x86_64 | 5 | " - "Intel x86_64 Atom System Image | " - "system-images/android-31/default/x86_64\n" + "Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" ) # Verify the system image that we already have diff --git a/tests/integrations/docker/test_Docker__x11_passthrough.py b/tests/integrations/docker/test_Docker__x11_passthrough.py index 1424af8deb..2abd5403c1 100644 --- a/tests/integrations/docker/test_Docker__x11_passthrough.py +++ b/tests/integrations/docker/test_Docker__x11_passthrough.py @@ -597,8 +597,7 @@ def test_x11_passthrough_xauth_fails(mock_tools, in_kwargs, out_kwargs, capsys): # User is warned that xauth failed assert capsys.readouterr().out == ( - "An X11 authentication database could not be created " - "for the display.\n" + "An X11 authentication database could not be created for the display.\n" "\n" "Briefcase will proceed, but if access to the display " "is rejected, this may be why.\n" diff --git a/tests/integrations/windows_sdk/test_WindowsSDK__verify.py b/tests/integrations/windows_sdk/test_WindowsSDK__verify.py index 3648aa9416..60bb90fa11 100644 --- a/tests/integrations/windows_sdk/test_WindowsSDK__verify.py +++ b/tests/integrations/windows_sdk/test_WindowsSDK__verify.py @@ -52,7 +52,6 @@ def setup_winsdk_install( sdk_path = base_path / "win_sdk" sdk_ver = version - # Extract the repeated path to keep lines short and clean bin_dir = sdk_path / "bin" / f"{sdk_ver}.0" / arch bin_dir.mkdir(parents=True, exist_ok=True) diff --git a/tests/integrations/xcode/test_ensure_xcode_is_installed.py b/tests/integrations/xcode/test_ensure_xcode_is_installed.py index f1107395c0..212131ce6c 100644 --- a/tests/integrations/xcode/test_ensure_xcode_is_installed.py +++ b/tests/integrations/xcode/test_ensure_xcode_is_installed.py @@ -1,6 +1,5 @@ import os import subprocess -from textwrap import dedent from unittest import mock import pytest @@ -225,22 +224,21 @@ def test_installed_extra_output(capsys, xcode, mock_tools): # This specific output was seen in the wild with Xcode 13.2.1; see #668 mock_tools.subprocess.check_output.side_effect = [ xcode + "\n", # xcode-select -p - dedent( - """\ - objc[86306]: Class AMSupportURLConnectionDelegate is """ - """implemented in both /usr/lib/libauthinstall.dylib """ - """(0x20d17ab90) and /Library/Apple/System/Library/""" - """PrivateFrameworks/MobileDevice.framework/Versions/A/""" - """MobileDevice (0x1084b82c8). One of the two will be """ - """used. Which one is undefined. - objc[86306]: Class AMSupportURLSession is implemented """ - """in both /usr/lib/libauthinstall.dylib (0x20d17abe0) """ - """and /Library/Apple/System/Library/PrivateFrameworks/""" - """MobileDevice.framework/Versions/A/MobileDevice """ - """(0x1084b8318). One of the two will be used. Which """ - """one is undefined. - Xcode 13.2.1 - "Build version 13C100""" + ( + "objc[86306]: Class AMSupportURLConnectionDelegate is " + "implemented in both /usr/lib/libauthinstall.dylib " + "(0x20d17ab90) and /Library/Apple/System/Library/" + "PrivateFrameworks/MobileDevice.framework/Versions/A/" + "MobileDevice (0x1084b82c8). One of the two will be " + "used. Which one is undefined.\n" + "objc[86306]: Class AMSupportURLSession is implemented " + "in both /usr/lib/libauthinstall.dylib (0x20d17abe0) " + "and /Library/Apple/System/Library/PrivateFrameworks/" + "MobileDevice.framework/Versions/A/MobileDevice " + "(0x1084b8318). One of the two will be used. Which " + "one is undefined.\n" + "Xcode 13.2.1\n" + "Build version 13C100" ), ] From c1e2307a40255d48f67bcfb40db04ad4b946c9db Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 5 Aug 2026 13:32:40 +0630 Subject: [PATCH 07/15] fix: plf\linux\system\test_run.py CI fail --- tests/platforms/linux/system/test_run.py | 153 ++++++++++++++--------- 1 file changed, 91 insertions(+), 62 deletions(-) diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index 5be45aab6c..624e19987a 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -139,13 +139,20 @@ def test_supported_host_os(run_command, first_app, sub_kw, tmp_path): run_command() # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - ( - f"{tmp_path / 'base_path/build/first-app/somevendor'}" - "/surprising/first-app-0.0.1/usr/bin/first-app" - ) - ], + [binary_path], cwd=f"{tmp_path / 'home'}", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -251,16 +258,20 @@ def test_run_gui_app(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=[]) # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - os.fsdecode( - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ) - ], + [binary_path], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -293,18 +304,20 @@ def test_run_gui_app_passthrough(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=["foo", "--bar"]) # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - os.fsdecode( - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ), - "foo", - "--bar", - ], + [binary_path], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -337,16 +350,20 @@ def test_run_gui_app_failed(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=[]) # The run command was still invoked + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - os.fsdecode( - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ) - ], + [binary_path], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -369,15 +386,21 @@ def test_run_console_app(run_command, first_app, tmp_path): run_command.run_app(first_app, passthrough=[]) # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) assert run_command.tools.subprocess.run.mock_calls == [ mock.call( - [ - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ], + [binary_path], cwd=tmp_path / "home", bufsize=1, stream_output=False, @@ -602,16 +625,20 @@ def test_run_app_test_mode( run_command.run_app(first_app, passthrough=[]) # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - os.fsdecode( - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ) - ], + [binary_path], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -737,18 +764,20 @@ def test_run_app_test_mode_with_args( ) # The process was started + binary_path = os.fsdecode( + tmp_path + / "base_path" + / "build" + / "first-app" + / "somevendor" + / "surprising" + / "first-app-0.0.1" + / "usr" + / "bin" + / "first-app" + ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [ - os.fsdecode( - tmp_path - / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" - ) - ), - "foo", - "--bar", - ], + [binary_path], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, From c358722b4c185fbb41dbf1bda99012faf64dfa18 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 5 Aug 2026 13:35:25 +0630 Subject: [PATCH 08/15] fix: remove E501 linting ignores --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c1d1d4b540..4590f9f24f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,9 +310,6 @@ known-third-party = ["build"] # debugger module *needs* to have debugpy trace imports. "debugger/src/briefcase_debugger/debugpy.py" = ["T100"] "debugger/tests/test_debugpy.py" = ["T100"] -# E501: line too long, to be fixed in future changes # fixed -#"tests/integrations/*" = ["E501"] -#"tests/platforms/*" = ["E501"] # PERF402: list copies, to be fixed in future changes "tests/commands/run/test_LogFilter.py" = ["PERF402"] "tests/platforms/macOS/test_XcodeBuildFilter.py" = ["PERF402"] From 3101feac30077a43d59682d4a7642025e51a04ba Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 5 Aug 2026 15:13:48 +0630 Subject: [PATCH 09/15] fix: argument missing error / CI Fails --- tests/platforms/linux/system/test_run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index 624e19987a..39293c8908 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -317,7 +317,7 @@ def test_run_gui_app_passthrough(run_command, first_app, sub_kw, tmp_path): / "first-app" ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [binary_path, "foo", "--bar"], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -777,7 +777,7 @@ def test_run_app_test_mode_with_args( / "first-app" ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [binary_path, "foo", "--bar"], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, From 69f58c1849a5d6c96b333c472e1e58b607d40059 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 5 Aug 2026 15:28:12 +0630 Subject: [PATCH 10/15] fix: reformating/ CI Fails --- tests/platforms/linux/system/test_run.py | 171 +++++++++-------------- 1 file changed, 68 insertions(+), 103 deletions(-) diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index 39293c8908..aee2a52176 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -139,20 +139,13 @@ def test_supported_host_os(run_command, first_app, sub_kw, tmp_path): run_command() # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [ + str( + tmp_path / "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ], cwd=f"{tmp_path / 'home'}", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -258,20 +251,16 @@ def test_run_gui_app(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=[]) # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [ + os.fsdecode( + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ) + ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -304,20 +293,18 @@ def test_run_gui_app_passthrough(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=["foo", "--bar"]) # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path, "foo", "--bar"], + [ + os.fsdecode( + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ), + "foo", + "--bar", + ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -350,20 +337,16 @@ def test_run_gui_app_failed(run_command, first_app, sub_kw, tmp_path): run_command.run_app(first_app, passthrough=[]) # The run command was still invoked - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [ + os.fsdecode( + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ) + ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -386,21 +369,15 @@ def test_run_console_app(run_command, first_app, tmp_path): run_command.run_app(first_app, passthrough=[]) # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) assert run_command.tools.subprocess.run.mock_calls == [ mock.call( - [binary_path], + [ + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ], cwd=tmp_path / "home", bufsize=1, stream_output=False, @@ -429,8 +406,8 @@ def test_run_console_app_passthrough(run_command, first_app, tmp_path): [ tmp_path / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" ), "foo", "--bar", @@ -464,8 +441,8 @@ def test_run_console_app_failed(run_command, first_app, sub_kw, tmp_path): [ tmp_path / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" ) ], cwd=tmp_path / "home", @@ -625,28 +602,21 @@ def test_run_app_test_mode( run_command.run_app(first_app, passthrough=[]) # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path], + [ + os.fsdecode( + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ) + ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, - env={ - "ENVVAR": "Value", - "BRIEFCASE_MAIN_MODULE": "tests.first_app", - }, + env={"ENVVAR": "Value", "BRIEFCASE_MAIN_MODULE": "tests.first_app"}, **sub_kw, ) @@ -764,28 +734,23 @@ def test_run_app_test_mode_with_args( ) # The process was started - binary_path = os.fsdecode( - tmp_path - / "base_path" - / "build" - / "first-app" - / "somevendor" - / "surprising" - / "first-app-0.0.1" - / "usr" - / "bin" - / "first-app" - ) run_command.tools.subprocess._subprocess.Popen.assert_called_with( - [binary_path, "foo", "--bar"], + [ + os.fsdecode( + tmp_path + / ( + "base_path/build/first-app/somevendor/surprising/" + "first-app-0.0.1/usr/bin/first-app" + ) + ), + "foo", + "--bar", + ], cwd=os.fsdecode(tmp_path / "home"), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, - env={ - "ENVVAR": "Value", - "BRIEFCASE_MAIN_MODULE": "tests.first_app", - }, + env={"ENVVAR": "Value", "BRIEFCASE_MAIN_MODULE": "tests.first_app"}, **sub_kw, ) From cabebb8cc5d93f78d36dbfab38ede3105f9d0be7 Mon Sep 17 00:00:00 2001 From: Phyo Pyae Sone Date: Wed, 12 Aug 2026 09:41:12 +0630 Subject: [PATCH 11/15] fix: #2 wrong formatting --- .../AndroidSDK/test_list_installed_images.py | 34 ++++----- .../AndroidSDK/test_verify_system_image.py | 14 ++-- .../docker/test_Docker__verify.py | 59 +++++++-------- .../docker/test_Docker__x11_passthrough.py | 4 +- .../xcode/test_ensure_xcode_is_installed.py | 22 ++---- .../gradle/test_android_log_clean_filter.py | 50 ++++--------- tests/platforms/android/gradle/test_run.py | 6 +- tests/platforms/iOS/xcode/test_run.py | 72 +++++++------------ tests/platforms/linux/appimage/test_build.py | 4 +- tests/platforms/linux/appimage/test_run.py | 18 ++--- tests/platforms/linux/system/test_create.py | 4 +- .../system/test_mixin__finalize_app_config.py | 20 +++--- .../linux/system/test_mixin__properties.py | 8 ++- .../linux/system/test_package__pkg.py | 8 +-- .../linux/system/test_package__rpm.py | 4 +- tests/platforms/linux/system/test_run.py | 48 +++++-------- .../platforms/macOS/app/package/test_ditto.py | 6 +- .../macOS/app/package/test_notarize.py | 7 +- .../macOS/app/package/test_package.py | 5 +- .../app/package/test_resume_notarization.py | 8 +-- tests/platforms/macOS/app/test_build.py | 4 +- tests/platforms/macOS/app/test_create.py | 52 +++++++------- tests/platforms/macOS/app/test_signing.py | 12 ++-- tests/platforms/macOS/conftest.py | 4 +- tests/platforms/macOS/test_SigningIdentity.py | 5 +- tests/platforms/web/static/test_build.py | 24 +++---- .../windows/visualstudio/test_run.py | 18 ++--- 27 files changed, 203 insertions(+), 317 deletions(-) diff --git a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py index ccd4dfcb18..aab1fb74ea 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py @@ -1,4 +1,5 @@ import subprocess +from textwrap import dedent import pytest @@ -8,17 +9,13 @@ def test_list_installed_system_images(mock_tools, android_sdk): """Returns a set of installed system image package identifiers.""" - mock_tools.subprocess.check_output.return_value = ( - "Installed packages:\n" - " Path | Version | " - "Description | Location\n" - " ------- | ------- | " - "------- | -------\n" - " system-images;android-31;default;x86_64 | 5 | " - "Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" - " emulator | 35.4.9 | " - "Android Emulator | emulator\n" - ) + mock_tools.subprocess.check_output.return_value = dedent("""\ + Installed packages:\n + Path | Version | Description | Location\n + ------- | ------- | ------- | -------\n + system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n + emulator | 35.4.9 | Android Emulator | emulator\n + """) # noqa: E501 result = android_sdk.list_installed_system_images() @@ -31,15 +28,12 @@ def test_list_installed_system_images(mock_tools, android_sdk): def test_no_installed_system_images(mock_tools, android_sdk): """If no system images are installed, an empty set is returned.""" - mock_tools.subprocess.check_output.return_value = ( - "Installed packages:\n" - " Path | Version | " - "Description | Location\n" - " ------- | ------- | " - "------- | -------\n" - " emulator | 35.4.9 | " - "Android Emulator | emulator\n" - ) + mock_tools.subprocess.check_output.return_value = dedent("""\ + Installed packages:\n + Path | Version | Description | Location\n + ------- | ------- | ------- | -------\n + emulator | 35.4.9 | Android Emulator | emulator\n + """) # noqa: E501 result = android_sdk.list_installed_system_images() diff --git a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py index aa5a8ce7ac..e044fbd2d0 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py @@ -1,5 +1,6 @@ import platform from subprocess import CalledProcessError +from textwrap import dedent import pytest @@ -85,15 +86,12 @@ def test_existing_system_image(mock_tools, android_sdk): mock_tools.host_arch = "AMD64" if platform.system() == "Windows" else "x86_64" # Mock sdkmanager reporting the system image as installed - mock_tools.subprocess.check_output.return_value = ( + mock_tools.subprocess.check_output.return_value = dedent("""\ "Installed packages:\n" - " Path | Version | " - "Description | Location\n" - " ------- | ------- | " - "------- | -------\n" - " system-images;android-31;default;x86_64 | 5 | " - "Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" - ) + " Path | Version | Description | Location\n" + " ------- | ------- | ------- | -------\n" + " system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" + """) # noqa: E501 # Verify the system image that we already have android_sdk.verify_system_image("system-images;android-31;default;x86_64") diff --git a/tests/integrations/docker/test_Docker__verify.py b/tests/integrations/docker/test_Docker__verify.py index c7519c96c9..e48a36ce84 100644 --- a/tests/integrations/docker/test_Docker__verify.py +++ b/tests/integrations/docker/test_Docker__verify.py @@ -1,6 +1,7 @@ import subprocess from collections import namedtuple from pathlib import Path +from textwrap import dedent from unittest.mock import MagicMock, call import pytest @@ -197,19 +198,15 @@ def test_docker_unknown_version(mock_tools, user_mapping_run_calls, capsys): def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): """If the docker daemon isn't running, the check fails.""" - error_message = ( - "\n" - "Client:\n" - " Debug Mode: false\n" - "\n" - "Server:\n" - "ERROR: Got permission denied while trying to connect to the Docker " - "daemon socket at unix:///var/run/docker.sock:\n" - "\n" - "Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix " - "/var/run/docker.sock: connect: permission denied\n" - "errors pretty printing info" - ) + error_message = dedent("""\ +Client: + Debug Mode: false + +Server: +ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: + +Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied +errors pretty printing info""") # noqa: E501 mock_tools.subprocess.check_output.side_effect = [ VALID_DOCKER_VERSION, @@ -229,26 +226,22 @@ def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): @pytest.mark.parametrize( "error_message", [ - ( - "\n" - "Client:\n" - " Debug Mode: false\n" - "\n" - "Server:\n" - "ERROR: Error response from daemon: dial unix docker.raw.sock: " - "connect: connection refused\n" - "errors pretty printing info\n" - ), # this is the error shown on mac - ( - "\n" - "Client:\n" - " Debug Mode: false\n" - "\n" - "Server:\n" - "ERROR: Cannot connect to the Docker daemon at " - "unix:///var/run/docker.sock. Is the docker daemon running?\n" - "errors pretty printing info" - ), # this is the error shown on linux + dedent("""\ +Client: + Debug Mode: false + +Server: +ERROR: Error response from daemon: dial unix docker.raw.sock: connect: connection refused +errors pretty printing info +"""), # noqa: E501 # this is the error shown on mac + dedent("""\ +Client: + Debug Mode: false + +Server: +ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? +errors pretty printing info"""), # noqa: E501 + # this is the error show on linux ], ) def test_docker_exists_but_is_not_running(error_message, mock_tools): diff --git a/tests/integrations/docker/test_Docker__x11_passthrough.py b/tests/integrations/docker/test_Docker__x11_passthrough.py index 2abd5403c1..baaba87e3e 100644 --- a/tests/integrations/docker/test_Docker__x11_passthrough.py +++ b/tests/integrations/docker/test_Docker__x11_passthrough.py @@ -111,8 +111,8 @@ def test_x11_is_display_tcp( ("is_socket_outcomes", "is_tcp_outcomes", "expected_display_num"), [ ([False], [False], 50), - # Due to short-circuiting, - # only the first iterator is consumed if it returns False + # Due to short-circuiting, only the first + # iterator is consumed if it returns False ([True, False], [False], 51), ([True, True, False, True, False], [False, False, False], 52), ([True] * 248 + [False, False], [True, False], 299), diff --git a/tests/integrations/xcode/test_ensure_xcode_is_installed.py b/tests/integrations/xcode/test_ensure_xcode_is_installed.py index 212131ce6c..8d662c64cc 100644 --- a/tests/integrations/xcode/test_ensure_xcode_is_installed.py +++ b/tests/integrations/xcode/test_ensure_xcode_is_installed.py @@ -1,5 +1,6 @@ import os import subprocess +from textwrap import dedent from unittest import mock import pytest @@ -224,22 +225,11 @@ def test_installed_extra_output(capsys, xcode, mock_tools): # This specific output was seen in the wild with Xcode 13.2.1; see #668 mock_tools.subprocess.check_output.side_effect = [ xcode + "\n", # xcode-select -p - ( - "objc[86306]: Class AMSupportURLConnectionDelegate is " - "implemented in both /usr/lib/libauthinstall.dylib " - "(0x20d17ab90) and /Library/Apple/System/Library/" - "PrivateFrameworks/MobileDevice.framework/Versions/A/" - "MobileDevice (0x1084b82c8). One of the two will be " - "used. Which one is undefined.\n" - "objc[86306]: Class AMSupportURLSession is implemented " - "in both /usr/lib/libauthinstall.dylib (0x20d17abe0) " - "and /Library/Apple/System/Library/PrivateFrameworks/" - "MobileDevice.framework/Versions/A/MobileDevice " - "(0x1084b8318). One of the two will be used. Which " - "one is undefined.\n" - "Xcode 13.2.1\n" - "Build version 13C100" - ), + dedent("""\ + objc[86306]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20d17ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1084b82c8). One of the two will be used. Which one is undefined. + objc[86306]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20d17abe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1084b8318). One of the two will be used. Which one is undefined. + Xcode 13.2.1 + "Build version 13C100"""), # noqa: E501 ] # Check passes without an error. diff --git a/tests/platforms/android/gradle/test_android_log_clean_filter.py b/tests/platforms/android/gradle/test_android_log_clean_filter.py index 2618108cab..2163831c5e 100644 --- a/tests/platforms/android/gradle/test_android_log_clean_filter.py +++ b/tests/platforms/android/gradle/test_android_log_clean_filter.py @@ -14,24 +14,15 @@ # System messages log ( "D/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so", - ( - "loaded /vendor/lib64/egl/libEGL_emulation.so", - False, - ), + ("loaded /vendor/lib64/egl/libEGL_emulation.so", False), ), ( - ("\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m"), - ( - "loaded /vendor/lib64/egl/libEGL_emulation.so", - False, - ), + "\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m", + ("loaded /vendor/lib64/egl/libEGL_emulation.so", False), ), ( - ("D/stdio : Could not find platform independent libraries "), - ( - "Could not find platform independent libraries ", - False, - ), + "D/stdio : Could not find platform independent libraries ", + ("Could not find platform independent libraries ", False), ), ( "D/MainActivity: onStart() start", @@ -43,21 +34,15 @@ ), # Python App messages ( - ("I/python.stdout: Python app launched & stored in Android Activity class"), - ( - "Python app launched & stored in Android Activity class", - True, - ), + "I/python.stdout: Python app launched & stored in Android Activity class", + ("Python app launched & stored in Android Activity class", True), ), ( ( "\x1b[32mI/python.stdout: Python app launched & " "stored in Android Activity class\x1b[0m" ), - ( - "Python app launched & stored in Android Activity class", - True, - ), + ("Python app launched & stored in Android Activity class", True), ), ( "I/python.stdout: ", @@ -72,25 +57,19 @@ ("", True), ), ( - ("\x1b[32m\x1b[98mI/python.stdout: this is colored output\x1b[32m\x1b[0m"), + "\x1b[32m\x1b[98mI/python.stdout: this is colored output\x1b[32m\x1b[0m", ("this is colored output", True), ), ( - ("I/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)"), - ( - "test_case (tests.foobar.test_other.TestOtherMethods)", - True, - ), + "I/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)", + ("test_case (tests.foobar.test_other.TestOtherMethods)", True), ), ( ( "\x1b[32mI/python.stderr: test_case " "(tests.foobar.test_other.TestOtherMethods)\x1b[0m" ), - ( - "test_case (tests.foobar.test_other.TestOtherMethods)", - True, - ), + ("test_case (tests.foobar.test_other.TestOtherMethods)", True), ), ( "I/python.stderr: ", @@ -107,10 +86,7 @@ ), ( "\x1b[33mThis doesn't match the regex\x1b[33m", - ( - "\x1b[33mThis doesn't match the regex\x1b[33m", - False, - ), + ("\x1b[33mThis doesn't match the regex\x1b[33m", False), ), ], ) diff --git a/tests/platforms/android/gradle/test_run.py b/tests/platforms/android/gradle/test_run.py index 8253d8e313..2e9b956c85 100644 --- a/tests/platforms/android/gradle/test_run.py +++ b/tests/platforms/android/gradle/test_run.py @@ -1082,10 +1082,8 @@ def mock_stream_output(app, stop_func, **kwargs): "sys_path_regex": "requirements$", "host_folder": str( tmp_path - / ( - "base_path/build/first-app/android/gradle/" - "app/build/python/pip/debug/common" - ) + / "base_path/build/first-app/android/gradle/" + / "app/build/python/pip/debug/common" ), }, } diff --git a/tests/platforms/iOS/xcode/test_run.py b/tests/platforms/iOS/xcode/test_run.py index 99a2abcbd6..91223ee8f4 100644 --- a/tests/platforms/iOS/xcode/test_run.py +++ b/tests/platforms/iOS/xcode/test_run.py @@ -164,10 +164,8 @@ def test_run_app_simulator_booted(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -439,10 +437,8 @@ def test_run_app_with_passthrough(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -582,10 +578,8 @@ def test_run_app_simulator_shut_down( "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -731,10 +725,8 @@ def test_run_app_simulator_shutting_down(run_command, first_app_config, tmp_path "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1011,10 +1003,8 @@ def test_run_app_simulator_install_failure(run_command, first_app_config, tmp_pa "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), ] @@ -1118,10 +1108,8 @@ def test_run_app_simulator_launch_failure(run_command, first_app_config, tmp_pat "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1247,10 +1235,8 @@ def test_run_app_simulator_no_pid(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1378,10 +1364,8 @@ def test_run_app_simulator_non_integer_pid(run_command, first_app_config, tmp_pa "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1490,10 +1474,8 @@ def test_run_app_test_mode(run_command, first_app_config, tmp_path): "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1614,10 +1596,8 @@ def test_run_app_test_mode_with_passthrough(run_command, first_app_config, tmp_p "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( @@ -1730,10 +1710,8 @@ def test_run_app_debugger(run_command, first_app_generated, tmp_path, dummy_debu "sys_path_regex": "app_packages$", "host_folder": str( tmp_path - / ( - "base_path/build/first-app/ios/xcode/" - "app_packages.iphonesimulator" - ) + / "base_path/build/first-app/ios/xcode/" + / "app_packages.iphonesimulator" ), }, } @@ -1786,10 +1764,8 @@ def test_run_app_debugger(run_command, first_app_generated, tmp_path, dummy_debu "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first-app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first-app/ios/xcode/build/" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( diff --git a/tests/platforms/linux/appimage/test_build.py b/tests/platforms/linux/appimage/test_build.py index 0b02e55d7d..cc85bd3993 100644 --- a/tests/platforms/linux/appimage/test_build.py +++ b/tests/platforms/linux/appimage/test_build.py @@ -51,8 +51,8 @@ def build_command(dummy_console, tmp_path, first_app_config): command.use_docker = False command.extra_docker_build_args = [] - # Reset `os` mock without `spec` - # so tests can run on Windows where os.getuid doesn't exist. + # Reset `os` mock without `spec` so tests can + # run on Windows where os.getuid doesn't exist. command.tools.os = mock.MagicMock() # Mock user and group IDs for docker image command.tools.os.environ = mock.MagicMock() diff --git a/tests/platforms/linux/appimage/test_run.py b/tests/platforms/linux/appimage/test_run.py index 51781ef6dc..2d20b542e2 100644 --- a/tests/platforms/linux/appimage/test_run.py +++ b/tests/platforms/linux/appimage/test_run.py @@ -89,10 +89,8 @@ def test_run_gui_app_with_passthrough(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/linux/appimage/" - "First_App-0.0.1-x86_64.AppImage" - ), + / "base_path/build/first-app/linux/appimage/" + / "First_App-0.0.1-x86_64.AppImage", "foo", "--bar", ], @@ -172,10 +170,8 @@ def test_run_console_app_with_passthrough(run_command, first_app_config, tmp_pat run_command.tools.subprocess.run.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/linux/appimage/" - "First_App-0.0.1-x86_64.AppImage" - ), + / "base_path/build/first-app/linux/appimage/" + / "First_App-0.0.1-x86_64.AppImage", "foo", "--bar", ], @@ -274,10 +270,8 @@ def test_run_app_test_mode_with_args( run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/linux/appimage/" - "First_App-0.0.1-x86_64.AppImage" - ), + / "base_path/build/first-app/linux/appimage/" + / "First_App-0.0.1-x86_64.AppImage", "foo", "--bar", ], diff --git a/tests/platforms/linux/system/test_create.py b/tests/platforms/linux/system/test_create.py index bdb2e5ce56..e008e939c0 100644 --- a/tests/platforms/linux/system/test_create.py +++ b/tests/platforms/linux/system/test_create.py @@ -136,8 +136,8 @@ def test_output_format_template_context( def test_output_format_template_context_no_docker(create_command, first_app_config): """If not using Docker, `use_non_root_user` default in template is used.""" - # Mock the host to Linux to avoid flagging - # any "always use non-root user on macOS" logic. + # Mock the host to Linux to avoid flagging any + # "always use non-root user on macOS" logic. create_command.tools.host_os = "Linux" # Add some properties defined in config finalization diff --git a/tests/platforms/linux/system/test_mixin__finalize_app_config.py b/tests/platforms/linux/system/test_mixin__finalize_app_config.py index a4371cf515..6d9cb00ee8 100644 --- a/tests/platforms/linux/system/test_mixin__finalize_app_config.py +++ b/tests/platforms/linux/system/test_mixin__finalize_app_config.py @@ -176,8 +176,8 @@ def test_docker_arch_without_user_mapping(create_command, first_app_config, tmp_ def test_properties(create_command, first_app_config): """The final app config is the result of merging target properties, plus other derived properties.""" - # Run this test as "docker"; however, - # the things we're testing aren't docker specific. + # Run this test as "docker"; however, the things + # we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -253,8 +253,8 @@ def test_properties(create_command, first_app_config): def test_properties_unknown_basevendor(create_command, first_app_config): """If the base vendor can't be identified, the merge still succeeds.""" - # Run this test as "docker"; however, - # the things we're testing aren't docker specific. + # Run this test as "docker"; however, the things + # we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -378,8 +378,8 @@ def test_properties_no_basevendor_config(create_command, first_app_config): def test_properties_no_vendor(create_command, first_app_config): """If there's no vendor-specific config, the merge succeeds.""" - # Run this test as "docker"; however, - # the things we're testing aren't docker specific. + # Run this test as "docker"; however, the things + # we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -431,8 +431,8 @@ def test_properties_no_vendor(create_command, first_app_config): def test_properties_no_version(create_command, first_app_config): """If there's no version-specific config, the merge succeeds.""" - # Run this test as "docker"; however, - # the things we're testing aren't docker specific. + # Run this test as "docker"; however, the things + # we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") @@ -531,8 +531,8 @@ def test_passive_mixin(dummy_console, first_app_config, tmp_path): def test_cascading_distribution_properties(create_command, first_app_config): """Properties should be cascading/accumulating, and vendor-level properties should overwrite os-level ones when in a dictionary.""" - # Run this test as "docker"; however, - # the things we're testing aren't docker specific. + # Run this test as "docker"; however, the things + # we're testing aren't docker specific. create_command.target_image = "somevendor:surprising" create_command.tools.docker = MagicMock() create_command.target_glibc_version = MagicMock(return_value="2.42") diff --git a/tests/platforms/linux/system/test_mixin__properties.py b/tests/platforms/linux/system/test_mixin__properties.py index fe2a313300..9bd2336527 100644 --- a/tests/platforms/linux/system/test_mixin__properties.py +++ b/tests/platforms/linux/system/test_mixin__properties.py @@ -63,9 +63,11 @@ def test_binary_path(create_command, first_app_config, tmp_path): first_app_config.target_vendor = "somevendor" first_app_config.target_codename = "surprising" - assert create_command.binary_path(first_app_config) == tmp_path / ( - "base_path/build/first-app/somevendor/" - "surprising/first-app-0.0.1/usr/bin/first-app" + assert ( + create_command.binary_path(first_app_config) + == tmp_path + / "base_path/build/first-app/somevendor/" + / "surprising/first-app-0.0.1/usr/bin/first-app" ) diff --git a/tests/platforms/linux/system/test_package__pkg.py b/tests/platforms/linux/system/test_package__pkg.py index 6581af9053..a3ffeeb8d9 100644 --- a/tests/platforms/linux/system/test_package__pkg.py +++ b/tests/platforms/linux/system/test_package__pkg.py @@ -170,8 +170,8 @@ def test_pkg_package(package_command, first_app_pkg, tmp_path, changelog_filenam """A pkg app can be packaged.""" bundle_path = tmp_path / "base_path/build/first-app/somevendor/surprising" - # Remove CHANGELOG made in conftest.py and - # replace with another possible changelog format + # Remove CHANGELOG made in conftest.py and replace + # with another possible changelog format base_path = tmp_path / "base_path" old_changelog = base_path / "CHANGELOG" new_changelog = base_path / changelog_filename @@ -501,8 +501,8 @@ def test_no_changelog(package_command, first_app_pkg, tmp_path): # The CHANGELOG file will not be copied assert not (bundle_path / "pkgbuild/CHANGELOG").exists() - # The PKGBUILD file will not exist - # (as existence of changelog is checked before writing the PKGBUILD file) + # The PKGBUILD file will not exist (as existence of changelog + # is checked before writing the PKGBUILD file) assert not (bundle_path / "pkgbuild/PKGBUILD").exists() # No source tarball was created diff --git a/tests/platforms/linux/system/test_package__rpm.py b/tests/platforms/linux/system/test_package__rpm.py index 7db6d4f846..cfde9b0cd9 100644 --- a/tests/platforms/linux/system/test_package__rpm.py +++ b/tests/platforms/linux/system/test_package__rpm.py @@ -170,8 +170,8 @@ def test_rpm_package(package_command, first_app_rpm, tmp_path, changelog_filenam """A rpm app can be packaged.""" bundle_path = tmp_path / "base_path/build/first-app/somevendor/surprising" - # Remove CHANGELOG made in conftest.py and - # replace with another possible changelog format + # Remove CHANGELOG made in conftest.py and replace + # with another possible changelog format base_path = tmp_path / "base_path" old_changelog = base_path / "CHANGELOG" new_changelog = base_path / changelog_filename diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index aee2a52176..b5aa9e0e8e 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -255,10 +255,8 @@ def test_run_gui_app(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ) ], cwd=os.fsdecode(tmp_path / "home"), @@ -297,10 +295,8 @@ def test_run_gui_app_passthrough(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ), "foo", "--bar", @@ -341,10 +337,8 @@ def test_run_gui_app_failed(run_command, first_app, sub_kw, tmp_path): [ os.fsdecode( tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ) ], cwd=os.fsdecode(tmp_path / "home"), @@ -373,10 +367,8 @@ def test_run_console_app(run_command, first_app, tmp_path): mock.call( [ tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ], cwd=tmp_path / "home", bufsize=1, @@ -405,10 +397,8 @@ def test_run_console_app_passthrough(run_command, first_app, tmp_path): mock.call( [ tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ), + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" "foo", "--bar", ], @@ -440,10 +430,8 @@ def test_run_console_app_failed(run_command, first_app, sub_kw, tmp_path): mock.call( [ tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ], cwd=tmp_path / "home", bufsize=1, @@ -606,10 +594,8 @@ def test_run_app_test_mode( [ os.fsdecode( tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ) ], cwd=os.fsdecode(tmp_path / "home"), @@ -738,10 +724,8 @@ def test_run_app_test_mode_with_args( [ os.fsdecode( tmp_path - / ( - "base_path/build/first-app/somevendor/surprising/" - "first-app-0.0.1/usr/bin/first-app" - ) + / "base_path/build/first-app/somevendor/surprising/" + / "first-app-0.0.1/usr/bin/first-app" ), "foo", "--bar", diff --git a/tests/platforms/macOS/app/package/test_ditto.py b/tests/platforms/macOS/app/package/test_ditto.py index 2082048711..b25086e5c1 100644 --- a/tests/platforms/macOS/app/package/test_ditto.py +++ b/tests/platforms/macOS/app/package/test_ditto.py @@ -36,9 +36,9 @@ def test_ditto( # The archive contains the app as the only top level element. with ZipFile(archive_path) as archive: - # zip file can include a “__MACOSX” folder for - # each document that contains information about - # the file useful for Finder and will not be in the unzipped set of files + # zip file can include a "_MACOSX" folder for each document that + # contains information about the file useful for Finder, but it + # will not be in the unzipped set of files archived_files = [ fn for fn in archive.namelist() if not fn.startswith("__MACOSX/") ] diff --git a/tests/platforms/macOS/app/package/test_notarize.py b/tests/platforms/macOS/app/package/test_notarize.py index e16cc7990a..99de74be4a 100644 --- a/tests/platforms/macOS/app/package/test_notarize.py +++ b/tests/platforms/macOS/app/package/test_notarize.py @@ -98,10 +98,9 @@ def test_notarize_app( package_command.notarize(first_app_zip, identity=sekrit_identity) # As a result of mocking ditto, the zip archive won't *actually* be created; - # and as a result of mocking os, it won't *actually* be deleted either - but we can - # verify that it *would* have been deleted. - # ditto will also be called when finalizing, - # to create the actual distribution artefact. + # and as a result of mocking os, it won't *actually* be deleted either - but + # we can verify that it *would* have been deleted. ditto will also be called + # when finalizing, to create the actual distribution artefact. assert package_command.ditto_archive.mock_calls == [ mock.call(app_path, archive_path), mock.call(app_path, tmp_path / "base_path/dist/First App-0.0.1.app.zip"), diff --git a/tests/platforms/macOS/app/package/test_package.py b/tests/platforms/macOS/app/package/test_package.py index b0babbce9b..7fe95706c8 100644 --- a/tests/platforms/macOS/app/package/test_package.py +++ b/tests/platforms/macOS/app/package/test_package.py @@ -456,9 +456,8 @@ def test_notarize_adhoc_signed_via_prompt( package_command.select_identity.return_value = adhoc_identity - # Package the app without code signing. - # Use the base command's interface to ensure the full - # cleanup process is tested. + # Package the app without code signing. Use the base command's + # interface to ensure the full cleanup process is tested. with pytest.raises( BriefcaseCommandError, match=r"Can't notarize an app with an ad-hoc signing identity", diff --git a/tests/platforms/macOS/app/package/test_resume_notarization.py b/tests/platforms/macOS/app/package/test_resume_notarization.py index dd37e77dbf..51201b8c95 100644 --- a/tests/platforms/macOS/app/package/test_resume_notarization.py +++ b/tests/platforms/macOS/app/package/test_resume_notarization.py @@ -295,8 +295,8 @@ def test_resume_notarize_pkg( "distribution file", ) - # 2 calls are made to determine identity - - # the app identity, then the installer identity. + # 2 calls are made to determine identity - the + # app identity, then the installer identity. package_command.select_identity.side_effect = [ sekrit_identity, sekrit_installer_identity, @@ -816,8 +816,8 @@ def test_resume_notarize_from_marker_rejected( # The marker exists on disk, ready to be auto-detected. assert marker_path.exists() - # Resume notarization. - # The marker is auto-detected, but the notarization is rejected. + # Resume notarization. The marker is auto-detected, + # but the notarization is rejected. with pytest.raises( BriefcaseCommandError, match=r"Notarization was rejected: Bad mojo", diff --git a/tests/platforms/macOS/app/test_build.py b/tests/platforms/macOS/app/test_build.py index 3733aa2d8d..4a35423c16 100644 --- a/tests/platforms/macOS/app/test_build.py +++ b/tests/platforms/macOS/app/test_build.py @@ -73,8 +73,8 @@ def test_build_app( arch="gothic", ) - # Verify that a request has been made to sign the app, - # but only when it is as part of a direct build command + # Verify that a request has been made to sign the app, but + # only when it is as part of a direct build command if "adhoc_sign" in kwargs: # build command was called as part of package command. # expect no signing now since it will happen during packaging diff --git a/tests/platforms/macOS/app/test_create.py b/tests/platforms/macOS/app/test_create.py index e3dcfed311..ab87159df1 100644 --- a/tests/platforms/macOS/app/test_create.py +++ b/tests/platforms/macOS/app/test_create.py @@ -46,7 +46,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated { "info": {}, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, }, }, @@ -65,7 +65,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCustomPermission": "Custom message", }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, "com.apple.vm.networking": True, }, @@ -85,7 +85,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ) }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.bluetooth": True, }, @@ -103,7 +103,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCameraUsageDescription": "I need to see you", }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.camera": True, }, @@ -121,7 +121,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSMicrophoneUsageDescription": "I need to hear you", }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, "com.apple.security.device.microphone": True, }, @@ -141,9 +141,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -161,9 +161,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -181,9 +181,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -202,9 +202,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -223,9 +223,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -244,9 +244,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -266,9 +266,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.location"): True, + "com.apple.security.personal-information.location": True, }, }, ), @@ -284,9 +284,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSPhotoLibraryUsageDescription": ("I need to see your library"), }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": True, - ("com.apple.security.personal-information.photo_library"): True, + "com.apple.security.personal-information.photo_library": True, }, }, ), @@ -310,9 +310,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSCustomMessage": "Custom message", }, "entitlements": { - ("com.apple.security.cs.allow-unsigned-executable-memory"): True, + "com.apple.security.cs.allow-unsigned-executable-memory": True, "com.apple.security.cs.disable-library-validation": False, - ("com.apple.security.personal-information.location"): False, + "com.apple.security.personal-information.location": False, "com.apple.vm.networking": True, }, }, @@ -1146,10 +1146,8 @@ def test_install_support_package( assert (bundle_path / "support/Python.xcframework/Info.plist").exists() assert ( bundle_path - / ( - "support/Python.xcframework/macos-arm64_x86_64/" - "Python.framework/Versions/Current/Python" - ) + / "support/Python.xcframework/macos-arm64_x86_64/" + / "Python.framework/Versions/Current/Python" ).is_file() assert ( bundle_path diff --git a/tests/platforms/macOS/app/test_signing.py b/tests/platforms/macOS/app/test_signing.py index c0dfb5b4a5..fb0abf5774 100644 --- a/tests/platforms/macOS/app/test_signing.py +++ b/tests/platforms/macOS/app/test_signing.py @@ -266,8 +266,8 @@ def test_select_app_identity_no_adhoc(dummy_command): def test_select_installer_identity(dummy_command): """The user can select from a list of installer identities.""" - # get_identities is invoked twice - - # once with app identities, and once with all identities. + # get_identities is invoked twice - once with app + # identities, and once with all identities. dummy_command.get_identities.side_effect = [ { "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( @@ -316,8 +316,8 @@ def test_select_installer_identity(dummy_command): def test_installer_identity_matching_app(dummy_command): """The list of possible installer identities includes non-app identities from the same team.""" - # get_identities is invoked twice - - # once with app identities, and once with all identities. + # get_identities is invoked twice - once with app + # identities, and once with all identities. dummy_command.get_identities.side_effect = [ { "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( @@ -385,8 +385,8 @@ def test_installer_identity_matching_app(dummy_command): def test_installer_identity_no_match(dummy_command): """The list of possible installer identities includes non-app identities from the same team.""" - # get_identities is invoked twice - - # once with app identities, and once with all identities. + # get_identities is invoked twice - once with app + # identities, and once with all identities. dummy_command.get_identities.side_effect = [ { "38EBD6F8903EC63C238B04C1067833814CE47CA3": ( diff --git a/tests/platforms/macOS/conftest.py b/tests/platforms/macOS/conftest.py index bfae01cf9d..9ac2b5bc10 100644 --- a/tests/platforms/macOS/conftest.py +++ b/tests/platforms/macOS/conftest.py @@ -77,8 +77,8 @@ def first_app_templated(first_app_config, tmp_path): """\n""", ) - # Create the XCframework Info.plist file, - # with a deliberately weird min macOS version + # Create the XCframework Info.plist file, with + # a deliberately weird min macOS version create_plist_file( ( tmp_path diff --git a/tests/platforms/macOS/test_SigningIdentity.py b/tests/platforms/macOS/test_SigningIdentity.py index b917a65c99..ee4afb276e 100644 --- a/tests/platforms/macOS/test_SigningIdentity.py +++ b/tests/platforms/macOS/test_SigningIdentity.py @@ -45,9 +45,8 @@ def test_adhoc_identity(): """An ad-hoc identity can be created.""" adhoc = SigningIdentity() assert adhoc.id == "-" - assert ( - adhoc.name == "Ad-hoc identity. The resulting package will run " - "but cannot be re-distributed." + assert adhoc.name == ( + "Ad-hoc identity. The resulting package will run but cannot be re-distributed." ) assert adhoc.is_adhoc assert repr(adhoc) == "" diff --git a/tests/platforms/web/static/test_build.py b/tests/platforms/web/static/test_build.py index 570e7bd2a4..ed979ecebf 100644 --- a/tests/platforms/web/static/test_build.py +++ b/tests/platforms/web/static/test_build.py @@ -168,18 +168,14 @@ def mock_run(*args, **kwargs): --------------------------------------------------> - - + + @@ -215,10 +211,8 @@ def mock_run(*args, **kwargs): #pyconsole { display: None; } - /**************************************************""" - """***************** - ******************** Wheel contributed styles """ - """********************/ + /******************************************************************* + ******************** Wheel contributed styles ********************/ /*@@ css:start @@*/ /************************************************** * dependency 1.2.3 (legacy static CSS: style.css) @@ -463,10 +457,8 @@ def mock_run(*args, **kwargs): #pyconsole { display: None; } - /**************************************************""" - """***************** - ******************** Wheel contributed styles """ - """********************/ + /******************************************************************* + ******************** Wheel contributed styles ********************/ /*@@ css:start @@*/ /************************************************** * first_app 1.2.3 (legacy static CSS: style.css) diff --git a/tests/platforms/windows/visualstudio/test_run.py b/tests/platforms/windows/visualstudio/test_run.py index ab691bd18b..5a29695134 100644 --- a/tests/platforms/windows/visualstudio/test_run.py +++ b/tests/platforms/windows/visualstudio/test_run.py @@ -75,10 +75,8 @@ def test_run_app_with_args(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/windows/" - "visualstudio/x64/Release/First App.exe" - ), + / "base_path/build/first-app/windows/" + / "visualstudio/x64/Release/First App.exe", "foo", "--bar", ], @@ -112,10 +110,8 @@ def test_run_app_test_mode(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/windows/" - "visualstudio/x64/Release/First App.exe" - ) + / "base_path/build/first-app/windows/" + / "visualstudio/x64/Release/First App.exe" ], cwd=tmp_path / "home", encoding="UTF-8", @@ -151,10 +147,8 @@ def test_run_app_test_mode_with_args(run_command, first_app_config, tmp_path): run_command.tools.subprocess.Popen.assert_called_with( [ tmp_path - / ( - "base_path/build/first-app/windows/" - "visualstudio/x64/Release/First App.exe" - ), + / "base_path/build/first-app/windows/" + / "visualstudio/x64/Release/First App.exe", "foo", "--bar", ], From 2342c0e04d5f365b14553c9c34faaf23278c2985 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Wed, 12 Aug 2026 11:44:17 +0100 Subject: [PATCH 12/15] Fix Ruff errors from merge --- pyproject.toml | 5 +++++ tests/integrations/android_sdk/ADB/test_install_apk.py | 4 +++- tests/integrations/gnupg/conftest.py | 4 ++-- .../conda/test_CondaEnvManager__install_requirements.py | 6 ++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e33b43c954..89da801eca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,6 +310,11 @@ known-third-party = ["build"] # debugger module *needs* to have debugpy trace imports. "debugger/src/briefcase_debugger/debugpy.py" = ["T100"] "debugger/tests/test_debugpy.py" = ["T100"] + +# A standalone maintenance script, not part of the briefcase package; it +# *needs* to print its output for a maintainer to read. +"scripts/update_template_hashes.py" = ["T201"] + # PERF402: list copies, to be fixed in future changes "tests/commands/run/test_LogFilter.py" = ["PERF402"] "tests/platforms/macOS/test_XcodeBuildFilter.py" = ["PERF402"] diff --git a/tests/integrations/android_sdk/ADB/test_install_apk.py b/tests/integrations/android_sdk/ADB/test_install_apk.py index 2192f95ff7..bafc499538 100644 --- a/tests/integrations/android_sdk/ADB/test_install_apk.py +++ b/tests/integrations/android_sdk/ADB/test_install_apk.py @@ -44,7 +44,9 @@ def test_install_failure_update_incompatible(adb, capsys): side_effect=subprocess.CalledProcessError( returncode=1, cmd="install", - output="Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: signatures do not match]", + output=( + "Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: signatures do not match]" + ), ) ) diff --git a/tests/integrations/gnupg/conftest.py b/tests/integrations/gnupg/conftest.py index fb1dca4872..23c9c1e3e0 100644 --- a/tests/integrations/gnupg/conftest.py +++ b/tests/integrations/gnupg/conftest.py @@ -17,7 +17,7 @@ def gpg(mock_tools): "sec:u:255:22:F9FCBC4A7701B685:1785485940:::u:::scSC:::+::ed25519:::0:", f"fpr:::::::::{JANE}:", # codespell:ignore fpr "grp:::::::::A93A9F4A002A4796BB0196F46C2ED4F603F95854:", - "uid:u::::1785485940::E70814C3C8DC3AC3940E8BFBA0288F0CE55F2120::Jane Doe ::::::::::0:", + "uid:u::::1785485940::E70814C3C8DC3AC3940E8BFBA0288F0CE55F2120::Jane Doe ::::::::::0:", # noqa: E501 "ssb:u:255:22:5B0C17E0E2D05DD5611BF7A3F9FCBC4A7701B685:1785485940:::u:::e:::+::ed25519:::0:", "fpr:::::::::5B0C17E0E2D05DD5611BF7A3F9FCBC4A7701B685:", # codespell:ignore fpr ] @@ -28,7 +28,7 @@ def gpg(mock_tools): [ "sec:u:3072:1:4D68E1A93D2F47FB:1785485980:::u:::scESC:::::::", f"fpr:::::::::{BOB}:", # codespell:ignore fpr - "uid:u::::1785485980::89A2D4C6E5F8B3E7::Bob Builder ::::::::::0:", + "uid:u::::1785485980::89A2D4C6E5F8B3E7::Bob Builder ::::::::::0:", # noqa: E501 ] ) BOB_OUTPUT += "\n" diff --git a/tests/integrations/virtual_environment/conda/test_CondaEnvManager__install_requirements.py b/tests/integrations/virtual_environment/conda/test_CondaEnvManager__install_requirements.py index 6a91953b12..249c08cf5c 100644 --- a/tests/integrations/virtual_environment/conda/test_CondaEnvManager__install_requirements.py +++ b/tests/integrations/virtual_environment/conda/test_CondaEnvManager__install_requirements.py @@ -131,7 +131,8 @@ def test_install_mixed_requirements(mock_tools, venv, tmp_path): ], ) - # Two install calls required - one to Conda, and one to pip (to install local packages) + # Two install calls required - one to Conda, and one to pip (to install local + # packages) assert mock_tools.subprocess.run.mock_calls == [ call( [ @@ -175,7 +176,8 @@ def test_disable_include_dependencies(mock_tools, venv, tmp_path): include_deps=False, ) - # Two install calls required - one to Conda, and one to pip (to install local packages) + # Two install calls required - one to Conda, and one to pip (to install local + # packages) assert mock_tools.subprocess.run.mock_calls == [ call( [ From 78020a4090157f8865d2f6a024cb183f56a4a65e Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Wed, 12 Aug 2026 11:56:46 +0100 Subject: [PATCH 13/15] Fix test failures --- .../AndroidSDK/test_list_installed_images.py | 18 +++++++++--------- .../AndroidSDK/test_verify_system_image.py | 8 ++++---- tests/platforms/linux/system/test_run.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py index aab1fb74ea..e9673d4203 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_list_installed_images.py @@ -10,11 +10,11 @@ def test_list_installed_system_images(mock_tools, android_sdk): """Returns a set of installed system image package identifiers.""" mock_tools.subprocess.check_output.return_value = dedent("""\ - Installed packages:\n - Path | Version | Description | Location\n - ------- | ------- | ------- | -------\n - system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n - emulator | 35.4.9 | Android Emulator | emulator\n + Installed packages: + Path | Version | Description | Location + ------- | ------- | ------- | ------- + system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64 + emulator | 35.4.9 | Android Emulator | emulator """) # noqa: E501 result = android_sdk.list_installed_system_images() @@ -29,10 +29,10 @@ def test_list_installed_system_images(mock_tools, android_sdk): def test_no_installed_system_images(mock_tools, android_sdk): """If no system images are installed, an empty set is returned.""" mock_tools.subprocess.check_output.return_value = dedent("""\ - Installed packages:\n - Path | Version | Description | Location\n - ------- | ------- | ------- | -------\n - emulator | 35.4.9 | Android Emulator | emulator\n + Installed packages: + Path | Version | Description | Location + ------- | ------- | ------- | ------- + emulator | 35.4.9 | Android Emulator | emulator """) # noqa: E501 result = android_sdk.list_installed_system_images() diff --git a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py index e044fbd2d0..aedb857af6 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_verify_system_image.py @@ -87,10 +87,10 @@ def test_existing_system_image(mock_tools, android_sdk): # Mock sdkmanager reporting the system image as installed mock_tools.subprocess.check_output.return_value = dedent("""\ - "Installed packages:\n" - " Path | Version | Description | Location\n" - " ------- | ------- | ------- | -------\n" - " system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64\n" + Installed packages: + Path | Version | Description | Location + ------- | ------- | ------- | ------- + system-images;android-31;default;x86_64 | 5 | Intel x86_64 Atom System Image | system-images/android-31/default/x86_64 """) # noqa: E501 # Verify the system image that we already have diff --git a/tests/platforms/linux/system/test_run.py b/tests/platforms/linux/system/test_run.py index b5aa9e0e8e..0e70432920 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -398,7 +398,7 @@ def test_run_console_app_passthrough(run_command, first_app, tmp_path): [ tmp_path / "base_path/build/first-app/somevendor/surprising/" - / "first-app-0.0.1/usr/bin/first-app" + / "first-app-0.0.1/usr/bin/first-app", "foo", "--bar", ], From 74a3d740ef347f9005bf7b1cedff4a6285325669 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Wed, 12 Aug 2026 12:38:53 +0100 Subject: [PATCH 14/15] More cleanups --- .../docker/test_Docker__verify.py | 41 ++++----- .../platforms/macOS/test_XcodeBuildFilter.py | 85 ------------------- 2 files changed, 22 insertions(+), 104 deletions(-) diff --git a/tests/integrations/docker/test_Docker__verify.py b/tests/integrations/docker/test_Docker__verify.py index e48a36ce84..847f107fe6 100644 --- a/tests/integrations/docker/test_Docker__verify.py +++ b/tests/integrations/docker/test_Docker__verify.py @@ -199,14 +199,15 @@ def test_docker_unknown_version(mock_tools, user_mapping_run_calls, capsys): def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): """If the docker daemon isn't running, the check fails.""" error_message = dedent("""\ -Client: - Debug Mode: false + Client: + Debug Mode: false -Server: -ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: + Server: + ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: -Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied -errors pretty printing info""") # noqa: E501 + Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied +errors pretty printing info + """) # noqa: E501 mock_tools.subprocess.check_output.side_effect = [ VALID_DOCKER_VERSION, @@ -226,22 +227,24 @@ def test_docker_exists_but_process_lacks_permission_to_use_it(mock_tools): @pytest.mark.parametrize( "error_message", [ + # Mac dedent("""\ -Client: - Debug Mode: false - -Server: -ERROR: Error response from daemon: dial unix docker.raw.sock: connect: connection refused -errors pretty printing info -"""), # noqa: E501 # this is the error shown on mac + Client: + Debug Mode: false + + Server: + ERROR: Error response from daemon: dial unix docker.raw.sock: connect: connection refused + errors pretty printing info + """), # noqa: E501 + # Linux dedent("""\ -Client: - Debug Mode: false + Client: + Debug Mode: false -Server: -ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? -errors pretty printing info"""), # noqa: E501 - # this is the error show on linux + Server: + ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? + errors pretty printing info + """), # noqa: E501 ], ) def test_docker_exists_but_is_not_running(error_message, mock_tools): diff --git a/tests/platforms/macOS/test_XcodeBuildFilter.py b/tests/platforms/macOS/test_XcodeBuildFilter.py index 57b0a7fc4d..3a1a82ef3b 100644 --- a/tests/platforms/macOS/test_XcodeBuildFilter.py +++ b/tests/platforms/macOS/test_XcodeBuildFilter.py @@ -46,91 +46,6 @@ "0x000000012890ba38 __63-[DTDKRemoteDeviceConnection " "startFirstServiceOf:unlockKeybag:]_block_invoke + 380" ), - ( - " 2 DTDeviceKitBase " - "0x000000012890b248 __48-[DTDKRemoteDeviceConnection " - "futureWithSession:]_block_invoke_4 + 28" - ), - ( - " 3 DTDeviceKitBase " - "0x0000000128901460 __DTDKExecuteInSession_block_invoke_2 + 68" - ), - ( - " 4 DTDeviceKitBase " - "0x0000000128900af0 " - "__DTDKExecuteWithConnection_block_invoke_2 + 216" - ), - ( - " 5 DTDeviceKitBase " - "0x00000001289009e8 " - "__DTDKExecuteWithConnection_block_invoke + 112" - ), - ( - " 6 libdispatch.dylib " - "0x00000001a81b4400 _dispatch_client_callout + 20" - ), - ( - " 7 libdispatch.dylib " - "0x00000001a81c397c " - "_dispatch_lane_barrier_sync_invoke_and_complete + 56" - ), - ( - " 8 DVTFoundation " - "0x0000000100fa8014 DVTDispatchBarrierSync + 148" - ), - ( - " 9 DVTFoundation " - "0x0000000100f842b4 -[DVTDispatchLock performLockedBlock:] + 60" - ), - ( - " 10 DTDeviceKitBase " - "0x00000001289008e4 DTDKExecuteWithConnection + 200" - ), - ( - " 11 DTDeviceKitBase " - "0x00000001289012e4 DTDKExecuteInSession + 260" - ), - ( - " 12 DTDeviceKitBase " - "0x000000012890b028 __48-[DTDKRemoteDeviceConnection " - "futureWithSession:]_block_invoke_2 + 204" - ), - ( - " 13 DVTFoundation " - "0x0000000100fa7330 __DVT_CALLING_CLIENT_BLOCK__ + 16" - ), - ( - " 14 DVTFoundation " - "0x0000000100fa7d58 __DVTDispatchAsync_block_invoke + 152" - ), - ( - " 15 libdispatch.dylib " - "0x00000001a81b2874 _dispatch_call_block_and_release + 32" - ), - ( - " 16 libdispatch.dylib " - "0x00000001a81b4400 _dispatch_client_callout + 20" - ), - ( - " 17 libdispatch.dylib " - "0x00000001a81bba88 _dispatch_lane_serial_drain + 668" - ), - ( - " 18 libdispatch.dylib " - "0x00000001a81bc62c _dispatch_lane_invoke + 436" - ), - ( - " 19 libdispatch.dylib " - "0x00000001a81c7244 _dispatch_workloop_worker_thread + 648" - ), - ( - " 20 libsystem_pthread.dylib " - "0x00000001a8360074 _pthread_wqthread + 288" - ), - ( - " 21 libsystem_pthread.dylib " - "0x00000001a835ed94 start_wqthread + 8" - ), ( "), DVTRadarComponentKey=261622, NSLocalizedDescription=The " "device is passcode protected.}}, NSLocalizedRecoverySuggestion=" From a846e42dda49c4bcbc7b57b0ffb19a8bbbfbbf5e Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Wed, 12 Aug 2026 13:46:23 +0100 Subject: [PATCH 15/15] More cleanups --- .../integrations/android_sdk/ADB/test_run.py | 14 ++++++------- tests/platforms/iOS/xcode/test_create.py | 10 +++++----- tests/platforms/iOS/xcode/test_run.py | 6 ++---- .../platforms/macOS/app/package/test_ditto.py | 14 ++++++------- tests/platforms/macOS/app/test_create.py | 20 +++++++++---------- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/tests/integrations/android_sdk/ADB/test_run.py b/tests/integrations/android_sdk/ADB/test_run.py index 0154d888e2..46392edbfd 100644 --- a/tests/integrations/android_sdk/ADB/test_run.py +++ b/tests/integrations/android_sdk/ADB/test_run.py @@ -1,6 +1,7 @@ import subprocess import sys from pathlib import Path +from textwrap import dedent import pytest @@ -90,13 +91,12 @@ def test_error_handling(mock_tools, adb, name, exception, tmp_path): def test_older_sdk_error(mock_tools, adb): """Failure [INSTALL_FAILED_OLDER_SDK] needs to be caught manually.""" - mock_tools.subprocess.check_output.return_value = ( - "Performing Push Install\n" - "C:/.../app-debug.apk: 1 file pushed, 0 skipped. 5.5 MB/s " - "(33125287 bytes in 5.768s)\n" - " pkg: /data/local/tmp/app-debug.apk\n" - "Failure [INSTALL_FAILED_OLDER_SDK]" - ) + mock_tools.subprocess.check_output.return_value = dedent("""\ + Performing Push Install + C:/.../app-debug.apk: 1 file pushed, 0 skipped. 5.5 MB/s (33125287 bytes in 5.768s) + pkg: /data/local/tmp/app-debug.apk + Failure [INSTALL_FAILED_OLDER_SDK] + """) # noqa: E501 with pytest.raises( BriefcaseCommandError, match=r"Your device doesn't meet the minimum SDK requirements of this app", diff --git a/tests/platforms/iOS/xcode/test_create.py b/tests/platforms/iOS/xcode/test_create.py index 9227ddbeab..5f24e21c8b 100644 --- a/tests/platforms/iOS/xcode/test_create.py +++ b/tests/platforms/iOS/xcode/test_create.py @@ -440,7 +440,7 @@ def test_incompatible_min_os_version( # Background location permissions ( { - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, { @@ -459,7 +459,7 @@ def test_incompatible_min_os_version( ( { "coarse_location": "I need to know roughly where you are", - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, { @@ -479,7 +479,7 @@ def test_incompatible_min_os_version( ( { "fine_location": "I need to know exactly where you are", - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, { @@ -516,7 +516,7 @@ def test_incompatible_min_os_version( { "coarse_location": "I need to know roughly where you are", "fine_location": "I need to know exactly where you are", - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, { @@ -540,7 +540,7 @@ def test_incompatible_min_os_version( {}, { "info": { - "NSPhotoLibraryAddUsageDescription": ("I need to see your library") + "NSPhotoLibraryAddUsageDescription": "I need to see your library" } }, ), diff --git a/tests/platforms/iOS/xcode/test_run.py b/tests/platforms/iOS/xcode/test_run.py index 91223ee8f4..2b4a4f1a1c 100644 --- a/tests/platforms/iOS/xcode/test_run.py +++ b/tests/platforms/iOS/xcode/test_run.py @@ -301,10 +301,8 @@ def test_run_app_simulator_booted_underscore( "install", "2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D", tmp_path - / ( - "base_path/build/first_app/ios/xcode/build/" - "Debug-iphonesimulator/First App.app" - ), + / "base_path/build/first_app/ios/xcode/build" + / "Debug-iphonesimulator/First App.app", ], ), mock.call( diff --git a/tests/platforms/macOS/app/package/test_ditto.py b/tests/platforms/macOS/app/package/test_ditto.py index b25086e5c1..308344723d 100644 --- a/tests/platforms/macOS/app/package/test_ditto.py +++ b/tests/platforms/macOS/app/package/test_ditto.py @@ -50,23 +50,23 @@ def test_ditto( "First App.app/Contents/Frameworks/Extras.framework/", "First App.app/Contents/Frameworks/Extras.framework/Extras", "First App.app/Contents/Frameworks/Extras.framework/Resources/", - ("First App.app/Contents/Frameworks/Extras.framework/Resources/Info.plist"), + "First App.app/Contents/Frameworks/Extras.framework/Resources/Info.plist", "First App.app/Contents/Frameworks/Extras.framework/Versions/", - ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/"), - ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/Extras"), - ("First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/libs/"), + "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/", + "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/Extras", + "First App.app/Contents/Frameworks/Extras.framework/Versions/1.2/libs/", ( "First App.app/Contents/Frameworks/Extras.framework/" "Versions/1.2/libs/extras.dylib" ), - ("First App.app/Contents/Frameworks/Extras.framework/Versions/Current"), + "First App.app/Contents/Frameworks/Extras.framework/Versions/Current", "First App.app/Contents/Info.plist", "First App.app/Contents/MacOS/", "First App.app/Contents/MacOS/First App", "First App.app/Contents/Resources/", "First App.app/Contents/Resources/app_packages/", "First App.app/Contents/Resources/app_packages/Extras.app/", - ("First App.app/Contents/Resources/app_packages/Extras.app/Contents/"), + "First App.app/Contents/Resources/app_packages/Extras.app/Contents/", ( "First App.app/Contents/Resources/app_packages/Extras.app/" "Contents/MacOS/" @@ -86,7 +86,7 @@ def test_ditto( "First App.app/Contents/Resources/app_packages/subfolder/" "second_dylib.dylib" ), - ("First App.app/Contents/Resources/app_packages/subfolder/second_so.so"), + "First App.app/Contents/Resources/app_packages/subfolder/second_so.so", "First App.app/Contents/Resources/app_packages/unknown.binary", ] diff --git a/tests/platforms/macOS/app/test_create.py b/tests/platforms/macOS/app/test_create.py index 1412707268..3f46bca7fb 100644 --- a/tests/platforms/macOS/app/test_create.py +++ b/tests/platforms/macOS/app/test_create.py @@ -132,7 +132,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Coarse location permissions ( { - "coarse_location": ("I need to know roughly where you are"), + "coarse_location": "I need to know roughly where you are", }, {}, {}, @@ -172,7 +172,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Background location permissions ( { - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, {}, @@ -192,8 +192,8 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Coarse location background permissions ( { - "coarse_location": ("I need to know roughly where you are"), - "background_location": ("I always need to know where you are"), + "coarse_location": "I need to know roughly where you are", + "background_location": "I always need to know where you are", }, {}, {}, @@ -214,7 +214,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated ( { "fine_location": "I need to know exactly where you are", - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, {}, @@ -234,7 +234,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Coarse and fine location permissions ( { - "coarse_location": ("I need to know roughly where you are"), + "coarse_location": "I need to know roughly where you are", "fine_location": "I need to know exactly where you are", }, {}, @@ -255,9 +255,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated # Coarse and fine background location permissions ( { - "coarse_location": ("I need to know roughly where you are"), + "coarse_location": "I need to know roughly where you are", "fine_location": "I need to know exactly where you are", - "background_location": ("I always need to know where you are"), + "background_location": "I always need to know where you are", }, {}, {}, @@ -283,7 +283,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "info": { - "NSPhotoLibraryUsageDescription": ("I need to see your library"), + "NSPhotoLibraryUsageDescription": "I need to see your library", }, "entitlements": { "com.apple.security.cs.allow-unsigned-executable-memory": True, @@ -302,7 +302,7 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated "NSLocationUsageDescription": "Platform specific", }, { - ("com.apple.security.personal-information.location"): False, + "com.apple.security.personal-information.location": False, "com.apple.security.cs.disable-library-validation": False, "com.apple.vm.networking": True, },