diff --git a/.gitignore b/.gitignore index 4c10e5dd34..9873717c38 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ coverage.xml /local __pycache__/ .ruff_cache/ +.venv/ /pip-wheel-metadata # IntelliJ Idea family of suites 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. diff --git a/pyproject.toml b/pyproject.toml index 06babc0a73..89da801eca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,12 +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"] -# E501: line too long, to be fixed in future changes -"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"] 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/android_sdk/ADB/test_run.py b/tests/integrations/android_sdk/ADB/test_run.py index 1c88a2af8d..46392edbfd 100644 --- a/tests/integrations/android_sdk/ADB/test_run.py +++ b/tests/integrations/android_sdk/ADB/test_run.py @@ -91,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 = dedent( - """\ + 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]""" - ) + 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/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..e9673d4203 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,13 +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: + 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() @@ -27,12 +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: + 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_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..cddbe80c19 100644 --- a/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py +++ b/tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py @@ -382,7 +382,8 @@ def test_emulator_fail_to_boot(mock_tools, android_sdk): "\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 + "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 26ca2f2232..aedb857af6 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 @@ -21,7 +22,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") @@ -82,12 +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 = ( - "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" - ) + mock_tools.subprocess.check_output.return_value = dedent("""\ + 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 android_sdk.verify_system_image("system-images;android-31;default;x86_64") @@ -130,7 +134,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..847f107fe6 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,15 +198,16 @@ 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 + 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: + 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""" + 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, @@ -225,21 +227,24 @@ 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 + # 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 + # Linux + 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 ], ) def test_docker_exists_but_is_not_running(error_message, mock_tools): @@ -290,7 +295,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..baaba87e3e 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({}), ): @@ -594,7 +599,8 @@ def test_x11_passthrough_xauth_fails(mock_tools, in_kwargs, out_kwargs, capsys): assert capsys.readouterr().out == ( "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 ad14816407..f67c00dc28 100644 --- a/tests/integrations/file/test_File__download.py +++ b/tests/integrations/file/test_File__download.py @@ -498,7 +498,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/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/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/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( [ 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..634da44fa5 100644 --- a/tests/integrations/visualstudio/test_VisualStudio__verify.py +++ b/tests/integrations/visualstudio/test_VisualStudio__verify.py @@ -9,11 +9,12 @@ 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 +260,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 +291,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 +314,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 +348,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 +358,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 +381,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..60bb90fa11 100644 --- a/tests/integrations/windows_sdk/test_WindowsSDK__verify.py +++ b/tests/integrations/windows_sdk/test_WindowsSDK__verify.py @@ -40,19 +40,25 @@ 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) + + 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 +164,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 +248,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 +267,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 +396,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 +450,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 ff40f39774..8d662c64cc 100644 --- a/tests/integrations/xcode/test_ensure_xcode_is_installed.py +++ b/tests/integrations/xcode/test_ensure_xcode_is_installed.py @@ -225,13 +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 - dedent( - """\ + 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""" - ), + "Build version 13C100"""), # noqa: E501 ] # Check passes without an error. 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", }, } 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..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,17 +14,11 @@ # 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, - ), + ("loaded /vendor/lib64/egl/libEGL_emulation.so", False), ), ( "D/stdio : Could not find platform independent libraries ", @@ -44,7 +38,10 @@ ("Python app launched & stored in Android Activity class", True), ), ( - "\x1b[32mI/python.stdout: Python app launched & stored in Android Activity class\x1b[0m", + ( + "\x1b[32mI/python.stdout: Python app launched & " + "stored in Android Activity class\x1b[0m" + ), ("Python app launched & stored in Android Activity class", True), ), ( @@ -68,7 +65,10 @@ ("test_case (tests.foobar.test_other.TestOtherMethods)", True), ), ( - "\x1b[32mI/python.stderr: test_case (tests.foobar.test_other.TestOtherMethods)\x1b[0m", + ( + "\x1b[32mI/python.stderr: test_case " + "(tests.foobar.test_other.TestOtherMethods)\x1b[0m" + ), ("test_case (tests.foobar.test_other.TestOtherMethods)", True), ), ( diff --git a/tests/platforms/android/gradle/test_run.py b/tests/platforms/android/gradle/test_run.py index 359770c451..817e8028a0 100644 --- a/tests/platforms/android/gradle/test_run.py +++ b/tests/platforms/android/gradle/test_run.py @@ -1090,7 +1090,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_create.py b/tests/platforms/iOS/xcode/test_create.py index a0c4b9483f..5f24e21c8b 100644 --- a/tests/platforms/iOS/xcode/test_create.py +++ b/tests/platforms/iOS/xcode/test_create.py @@ -124,7 +124,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" ), ) @@ -141,7 +142,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" ), @@ -375,7 +377,9 @@ def test_incompatible_min_os_version( {}, { "info": { - "NSBluetoothAlwaysUsageDescription": "I need to connect to bluetooth device." + "NSBluetoothAlwaysUsageDescription": ( + "I need to connect to bluetooth device." + ) }, }, ), @@ -412,7 +416,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" + ), } }, ), @@ -425,7 +431,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" + ), } }, ), @@ -437,8 +445,12 @@ def test_incompatible_min_os_version( {}, { "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"], } }, @@ -453,8 +465,12 @@ def test_incompatible_min_os_version( { "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"], } }, @@ -469,8 +485,12 @@ def test_incompatible_min_os_version( { "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"], } }, @@ -485,7 +505,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" + ), } }, ), @@ -500,8 +522,12 @@ def test_incompatible_min_os_version( { "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"], } }, diff --git a/tests/platforms/iOS/xcode/test_run.py b/tests/platforms/iOS/xcode/test_run.py index 09b71ddfa8..2b4a4f1a1c 100644 --- a/tests/platforms/iOS/xcode/test_run.py +++ b/tests/platforms/iOS/xcode/test_run.py @@ -164,7 +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( @@ -300,7 +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( @@ -433,7 +435,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( @@ -573,7 +576,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( @@ -719,7 +723,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( @@ -996,7 +1001,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", ], ), ] @@ -1100,7 +1106,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( @@ -1226,7 +1233,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( @@ -1354,7 +1362,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( @@ -1463,7 +1472,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( @@ -1584,7 +1594,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( @@ -1697,7 +1708,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" ), }, } @@ -1750,7 +1762,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 6f278c55c8..b3cb88558e 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() @@ -236,7 +237,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..2d20b542e2 100644 --- a/tests/platforms/linux/appimage/test_run.py +++ b/tests/platforms/linux/appimage/test_run.py @@ -89,7 +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", ], @@ -169,7 +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", ], @@ -268,7 +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/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..e008e939c0 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 a8cfd1dc03..6d9cb00ee8 100644 --- a/tests/platforms/linux/system/test_mixin__finalize_app_config.py +++ b/tests/platforms/linux/system/test_mixin__finalize_app_config.py @@ -82,7 +82,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) @@ -173,7 +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") @@ -249,7 +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") @@ -310,7 +315,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") @@ -372,7 +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") @@ -424,7 +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") @@ -523,7 +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 c35bea85be..9bd2336527 100644 --- a/tests/platforms/linux/system/test_mixin__properties.py +++ b/tests/platforms/linux/system/test_mixin__properties.py @@ -66,7 +66,8 @@ def test_binary_path(create_command, first_app_config, tmp_path): 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" + / "base_path/build/first-app/somevendor/" + / "surprising/first-app-0.0.1/usr/bin/first-app" ) @@ -117,7 +118,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 5b03faa43c..32eddc7619 100644 --- a/tests/platforms/linux/system/test_package.py +++ b/tests/platforms/linux/system/test_package.py @@ -233,6 +233,9 @@ def test_package_unknown_format(package_command, first_app, mock_gpg): # 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 4bfaa89503..69d282cc7d 100644 --- a/tests/platforms/linux/system/test_package__deb.py +++ b/tests/platforms/linux/system/test_package__deb.py @@ -323,7 +323,10 @@ def test_deb_package_no_long_description( # 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 ace2c73860..78de4d619a 100644 --- a/tests/platforms/linux/system/test_package__pkg.py +++ b/tests/platforms/linux/system/test_package__pkg.py @@ -177,7 +177,8 @@ def test_pkg_package( """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 @@ -370,7 +371,10 @@ def test_pkg_package_no_description(package_command, first_app_pkg, mock_gpg, tm # 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) @@ -509,7 +513,8 @@ def test_no_changelog(package_command, first_app_pkg, mock_gpg, 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 8274d392fa..891c983e47 100644 --- a/tests/platforms/linux/system/test_package__rpm.py +++ b/tests/platforms/linux/system/test_package__rpm.py @@ -177,7 +177,8 @@ def test_rpm_package( """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 @@ -471,7 +472,10 @@ def test_rpm_package_no_long_description( # 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 06115df582..0e70432920 100644 --- a/tests/platforms/linux/system/test_run.py +++ b/tests/platforms/linux/system/test_run.py @@ -141,7 +141,10 @@ 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'}" + 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, @@ -252,7 +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"), @@ -291,7 +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", @@ -332,7 +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"), @@ -361,7 +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, @@ -390,7 +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", ], @@ -422,7 +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, @@ -585,7 +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"), @@ -714,7 +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/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..308344723d 100644 --- a/tests/platforms/macOS/app/package/test_ditto.py +++ b/tests/platforms/macOS/app/package/test_ditto.py @@ -36,8 +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/") ] @@ -54,7 +55,10 @@ def test_ditto( "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/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/", @@ -63,8 +67,14 @@ def test_ditto( "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/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,7 +82,10 @@ 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_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..99de74be4a 100644 --- a/tests/platforms/macOS/app/package/test_notarize.py +++ b/tests/platforms/macOS/app/package/test_notarize.py @@ -98,9 +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"), @@ -730,7 +730,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 +798,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 +947,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..7fe95706c8 100644 --- a/tests/platforms/macOS/app/package/test_package.py +++ b/tests/platforms/macOS/app/package/test_package.py @@ -456,8 +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 60dda24fa0..51201b8c95 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..4a35423c16 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 a6596198c0..3f46bca7fb 100644 --- a/tests/platforms/macOS/app/test_create.py +++ b/tests/platforms/macOS/app/test_create.py @@ -82,7 +82,9 @@ 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, @@ -136,7 +138,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "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, @@ -154,7 +158,9 @@ 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, @@ -172,7 +178,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "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, @@ -191,7 +199,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "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, @@ -210,7 +220,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "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, @@ -229,7 +241,9 @@ 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, @@ -249,7 +263,9 @@ def create_command(dummy_console, mock_other_venv, tmp_path, first_app_templated {}, { "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, @@ -389,7 +405,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'\)." ), ): @@ -1354,7 +1371,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 a8b85dc387..fb0abf5774 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..9ac2b5bc10 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..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/macOS/test_XcodeBuildFilter.py b/tests/platforms/macOS/test_XcodeBuildFilter.py index 9e1b659186..3a1a82ef3b 100644 --- a/tests/platforms/macOS/test_XcodeBuildFilter.py +++ b/tests/platforms/macOS/test_XcodeBuildFilter.py @@ -25,30 +25,35 @@ ( [ "'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" + ), + ( + "), 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 +65,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;", ], [ @@ -72,7 +80,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;", ], [ @@ -84,11 +96,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;", ], [ 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 407d65360f..aa9f9c29fe 100644 --- a/tests/platforms/macOS/test_macOS_log_clean_filter.py +++ b/tests/platforms/macOS/test_macOS_log_clean_filter.py @@ -50,7 +50,10 @@ ), # 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.*) @@ -60,7 +63,10 @@ ), # 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) @@ -80,20 +86,32 @@ ), # 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 @@ -103,20 +121,32 @@ ), # 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 @@ -131,13 +161,17 @@ ), # 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), @@ -145,7 +179,8 @@ # 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 c10fa77272..ed979ecebf 100644 --- a/tests/platforms/web/static/test_build.py +++ b/tests/platforms/web/static/test_build.py @@ -293,7 +293,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) 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 a24fcb5cf4..bc6447d36c 100644 --- a/tests/platforms/windows/app/create/test_create.py +++ b/tests/platforms/windows/app/create/test_create.py @@ -92,7 +92,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( @@ -119,7 +120,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..5a29695134 100644 --- a/tests/platforms/windows/visualstudio/test_run.py +++ b/tests/platforms/windows/visualstudio/test_run.py @@ -75,7 +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", ], @@ -109,7 +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", @@ -145,7 +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", ],