From 3ec1457230dcb762739f9fa462a789440fa3d1a8 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Mon, 16 Feb 2026 13:20:00 +0000 Subject: [PATCH 01/11] fixing e501 for tests/commands --- pyproject.toml | 6 +- tests/commands/base/test_finalize.py | 6 +- tests/commands/base/test_parse_config.py | 4 +- tests/commands/base/test_paths.py | 5 +- .../base/test_update_cookiecutter_cache.py | 45 +- tests/commands/base/test_verify_template.py | 5 +- tests/commands/convert/test_input_app_name.py | 9 +- tests/commands/convert/test_input_license.py | 10 +- .../convert/test_input_test_source_dir.py | 20 +- .../convert/test_migrate_necessary_files.py | 20 +- tests/commands/create/test_create_app.py | 9 +- .../create/test_generate_app_template.py | 7 +- .../commands/create/test_install_app_code.py | 3 +- .../create/test_install_app_requirements.py | 12 +- tests/commands/create/test_install_image.py | 15 +- .../create/test_install_stub_binary.py | 2 +- tests/commands/dev/test_run_dev_app.py | 7 +- tests/commands/new/test_build_gui_context.py | 426 ++++++++++++------ tests/commands/run/test_LogFilter.py | 3 +- tests/commands/upgrade/test_call.py | 25 +- tests/test_cmdline.py | 15 +- 21 files changed, 430 insertions(+), 224 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 501a9683a..daed3f489 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -270,8 +270,10 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes -"tests/*" = ["E501"] -"src/briefcase/bootstraps/*" = ["E501"] +"tests/config/*" = ["E501"] +"tests/console/*" = ["E501"] +"tests/integrations/*" = ["E501"] +"tests/platforms/*" = ["E501"] [tool.rumdl] diff --git a/tests/commands/base/test_finalize.py b/tests/commands/base/test_finalize.py index a46907dc4..eb5f03ef0 100644 --- a/tests/commands/base/test_finalize.py +++ b/tests/commands/base/test_finalize.py @@ -83,7 +83,8 @@ def test_finalize_single(base_command, first_app, second_app): def test_finalize_all_repeat(base_command, first_app, second_app): - "Multiple calls to finalize verifies host & tools multiple times, but only once on config" + """Multiple calls to finalize verifies host & tools multiple times, but only once on + "config.""" # Finalize apps twice. This is an approximation of what happens # when a command chain is executed; create, update, build and run will # all finalize; create will finalize the app configs, each command will @@ -113,7 +114,8 @@ def test_finalize_all_repeat(base_command, first_app, second_app): def test_finalize_single_repeat(base_command, first_app, second_app): - "Multiple calls to finalize verifies host & tools multiple times, but finalizes app config once" + """Multiple calls to finalize verifies host & tools multiple times, but finalizes + app "config once.""" # Finalize app twice. This is an approximation of what happens # when a command chain is executed; create, update, build and run will diff --git a/tests/commands/base/test_parse_config.py b/tests/commands/base/test_parse_config.py index e8970992a..5fa495055 100644 --- a/tests/commands/base/test_parse_config.py +++ b/tests/commands/base/test_parse_config.py @@ -31,7 +31,9 @@ def test_incomplete_global_config(base_command): with pytest.raises( BriefcaseConfigError, - match=r"Global configuration is incomplete \(missing 'bundle', 'project_name'\)", + match=( + r"Global configuration is incomplete \(missing 'bundle', 'project_name'\)" + ), ): base_command.parse_config(filename, {}) diff --git a/tests/commands/base/test_paths.py b/tests/commands/base/test_paths.py index fd29f3947..cd900ca87 100644 --- a/tests/commands/base/test_paths.py +++ b/tests/commands/base/test_paths.py @@ -43,7 +43,10 @@ def raise_calledprpcesserror(*a, **kw): with pytest.raises( BriefcaseCommandError, - match=r"Failed to create the Briefcase directory to store tools and support files:", + match=( + r"Failed to create the Briefcase directory to store tools and support" + r" files:" + ), ): DummyCommand(console=dummy_console, data_path=data_path) diff --git a/tests/commands/base/test_update_cookiecutter_cache.py b/tests/commands/base/test_update_cookiecutter_cache.py index 7bdd81c69..ffba2def6 100644 --- a/tests/commands/base/test_update_cookiecutter_cache.py +++ b/tests/commands/base/test_update_cookiecutter_cache.py @@ -75,9 +75,9 @@ def test_new_repo_template_mkdir_interrupt(base_command, mock_git): """A really early interrupt will occur before the template dir is created.""" base_command.tools.git = mock_git - # We don't have a convenient point to insert a KeyboardInterrupt *before* creating the - # directory, so we fake the effect - make the side effect of the clone deletion of - # the entire folder; then raise the KeyboardInterrupt. + # We don't have a convenient point to insert a KeyboardInterrupt *before* creating + # the directory, so we fake the effect - make the side effect of the clone deletion + # of the entire folder; then raise the KeyboardInterrupt. def clone_failure(to_path, **kwargs): shutil.rmtree(to_path) raise KeyboardInterrupt() @@ -107,7 +107,8 @@ def test_new_repo_invalid_template_url(base_command, mock_git): with pytest.raises( BriefcaseCommandError, match=( - r"Unable to clone repository 'https://example.com/magic/special-template.git'" + r"Unable to clone repository" + r" 'https://example.com/magic/special-template.git'" ), ): base_command.update_cookiecutter_cache( @@ -131,30 +132,24 @@ def test_new_repo_invalid_template_url(base_command, mock_git): ("stderr_string", "error_message"), [ pytest.param( - "\n stderr: '\nfatal: could not clone repository 'https://example.com' \n'", + "\n stderr: '\nfatal: could not clone repository" + " 'https://example.com' \n'", "Could not clone repository 'https://example.com'.", id="tailing-whitespace-no-caps-no-period", ), pytest.param( - ( - "\n stderr: '\nfatal: Could not read from remote repository.\n\n" - "Please make sure you have the correct access rights\nand the repository exists. \n'" - ), - ( - "Could not read from remote repository.\n\nPlease make sure " - "you have the correct access rights\nand the repository exists." - ), + "\n stderr: '\nfatal: Could not read from remote repository.\n\nPlease" + " make sure you have the correct access rights\nand the repository" + " exists. \n'", + "Could not read from remote repository.\n\nPlease make sure " + "you have the correct access rights\nand the repository exists.", id="tailing-whitespace-has-caps-has-period", ), pytest.param( - ( - "\n stderr: '\nfatal: unable to access 'https://example.com/': " - "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal error'" - ), - ( - "Unable to access 'https://example.com/': OpenSSL/3.2.2: " - "error:0A000438:SSL routines::tlsv1 alert internal error." - ), + "\n stderr: '\nfatal: unable to access 'https://example.com/': " + "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal error'", + "Unable to access 'https://example.com/': OpenSSL/3.2.2: " + "error:0A000438:SSL routines::tlsv1 alert internal error.", id="no-tailing-whitespace-no-caps-no-period", ), pytest.param( @@ -179,8 +174,12 @@ def test_repo_clone_error(stderr_string, error_message, base_command, mock_git): with pytest.raises( BriefcaseCommandError, - # The error message should not retain the "fatal:" prefix; it isn't useful information to the user. - match=f"Unable to clone repository '{re.escape(repository)}'.\n\n?(?=3.2.1"] - # Override the cache of paths to specify an app packages path, but no support package path + # Override the cache of paths to specify an app packages path, but no support + # package path create_command._briefcase_toml[myapp] = { "paths": {"app_packages_path": "path/to/app_packages"} } @@ -738,7 +742,7 @@ def test_app_requirements_requirement_installer_args_with_template_support( assert myapp.test_requires is None -def test_app_requirements_requirement_installer_args_without_requires_no_template_support( +def test_app_requirements_requirement_installer_args_without_requires_no_template_support( # noqa: E501 create_command, myapp, app_path, @@ -768,7 +772,7 @@ def test_app_requirements_requirement_installer_args_without_requires_no_templat assert myapp.test_requires is None -def test_app_requirements_requirement_installer_args_without_requires_with_template_support( +def test_app_requirements_requirement_installer_args_without_requires_with_template_support( # noqa: E501 create_command, myapp, app_path, diff --git a/tests/commands/create/test_install_image.py b/tests/commands/create/test_install_image.py index dd5c1543c..2a0bc0d9c 100644 --- a/tests/commands/create/test_install_image.py +++ b/tests/commands/create/test_install_image.py @@ -146,7 +146,10 @@ def test_requested_size_invalid_path(create_command, tmp_path, capsys): ) # The right message was written to output - expected = "Unable to find input/original-3742.png for 3742px sample image; using default\n" + expected = ( + "Unable to find input/original-3742.png for 3742px sample image; using" + " default\n" + ) assert capsys.readouterr().out == expected # The file was not copied @@ -213,7 +216,10 @@ def test_variant_without_variant_source_and_no_requested_size( ) # The right message was written to output - expected = "Unable to find input/original-round.png for round sample image; using default\n" + expected = ( + "Unable to find input/original-round.png for round sample image; using" + " default\n" + ) assert capsys.readouterr().out == expected # No file was installed. @@ -308,7 +314,10 @@ def test_variant_with_size_without_variants(create_command, tmp_path, capsys): ) # The right message was written to output - expected = "Unable to find input/original-round-3742.png for 3742px round sample image; using default\n" + expected = ( + "Unable to find input/original-round-3742.png for 3742px round sample image;" + " using default\n" + ) assert capsys.readouterr().out == expected # No file was installed. diff --git a/tests/commands/create/test_install_stub_binary.py b/tests/commands/create/test_install_stub_binary.py index c259e8523..6d2acd7a0 100644 --- a/tests/commands/create/test_install_stub_binary.py +++ b/tests/commands/create/test_install_stub_binary.py @@ -265,7 +265,7 @@ def test_install_custom_stub_binary_url( # Confirm the right file was unpacked create_command.tools.shutil.unpack_archive.assert_called_with( filename=tmp_path - / "data/stub/986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb/My-Stub.zip", + / "data/stub/986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb/My-Stub.zip", # noqa: E501 extract_dir=tmp_path / "base_path/build/my-app/tester/dummy", ) diff --git a/tests/commands/dev/test_run_dev_app.py b/tests/commands/dev/test_run_dev_app.py index a131ceec1..5148b5d5d 100644 --- a/tests/commands/dev/test_run_dev_app.py +++ b/tests/commands/dev/test_run_dev_app.py @@ -172,10 +172,9 @@ def test_dev_test_mode_with_args(dev_command, first_app, is_console_app, tmp_pat sys.executable, "-c", ( - "import runpy, sys;" - "sys.path.pop(0);" - "sys.argv.extend(['foo', 'bar', '--whiz']);" - 'runpy.run_module("tests.first", run_name="__main__", alter_sys=True)' + "import runpy, sys;sys.path.pop(0);sys.argv.extend(['foo', 'bar'," + ' \'--whiz\']);runpy.run_module("tests.first", run_name="__main__",' + " alter_sys=True)" ), ], env={ diff --git a/tests/commands/new/test_build_gui_context.py b/tests/commands/new/test_build_gui_context.py index a9aa0b4cb..858573729 100644 --- a/tests/commands/new/test_build_gui_context.py +++ b/tests/commands/new/test_build_gui_context.py @@ -38,7 +38,8 @@ def test_toga_bootstrap(new_command): ) assert context == { - "app_source": '''\ + "app_source": ( + '''\ import toga from toga.style.pack import COLUMN, ROW @@ -60,14 +61,18 @@ def startup(self): def main(): return {{ cookiecutter.class_name }}() -''', - "app_start_source": """\ +''' + ), + "app_start_source": ( + """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main().main_loop() -""", - "pyproject_table_briefcase_app_extra_content": """ +""" + ), + "pyproject_table_briefcase_app_extra_content": ( + """ requires = [ ] test_requires = [ @@ -75,15 +80,19 @@ def main(): "pytest", {% endif %} ] -""", - "pyproject_table_macOS": """\ +""" + ), + "pyproject_table_macOS": ( + """\ universal_build = true requires = [ "toga-cocoa~=0.5.0", "std-nslog~=1.0.3", ] -""", - "pyproject_table_linux": """\ +""" + ), + "pyproject_table_linux": ( + """\ requires = [ "toga-gtk~=0.5.0", # PyGObject 3.52.1 enforces a requirement on libgirepository-2.0-dev. This library @@ -91,8 +100,10 @@ def main(): # older) releases, you can remove this version pin. See beeware/toga#3143. "pygobject < 3.52.1", ] -""", - "pyproject_table_linux_system_debian": """\ +""" + ), + "pyproject_table_linux_system_debian": ( + """\ system_requires = [ # Needed to compile pycairo wheel "libcairo2-dev", @@ -117,8 +128,10 @@ def main(): # Note: Debian 11 requires gir1.2-webkit2-4.0 instead # "gir1.2-webkit2-4.1", ] -""", - "pyproject_table_linux_system_rhel": """\ +""" + ), + "pyproject_table_linux_system_rhel": ( + """\ system_requires = [ # Needed to compile pycairo wheel "cairo-gobject-devel", @@ -136,8 +149,10 @@ def main(): # Needed to provide WebKit2 at runtime # "webkit2gtk3", ] -""", - "pyproject_table_linux_system_suse": """\ +""" + ), + "pyproject_table_linux_system_suse": ( + """\ system_requires = [ # Needed to compile pycairo wheel "cairo-devel", @@ -155,8 +170,10 @@ def main(): # Needed to provide WebKit2 at runtime # "libwebkit2gtk3", "typelib(WebKit2)", ] -""", - "pyproject_table_linux_system_arch": """\ +""" + ), + "pyproject_table_linux_system_arch": ( + """\ system_requires = [ # Needed to compile pycairo wheel "cairo", @@ -182,8 +199,10 @@ def main(): # Needed to provide WebKit2 at runtime # "webkit2gtk", ] -""", - "pyproject_table_linux_appimage": """\ +""" + ), + "pyproject_table_linux_appimage": ( + """\ manylinux = "manylinux_2_28" system_requires = [ @@ -203,24 +222,32 @@ def main(): linuxdeploy_plugins = [ "DEPLOY_GTK_VERSION=3 gtk", ] -""", - "pyproject_table_linux_flatpak": """\ +""" + ), + "pyproject_table_linux_flatpak": ( + """\ flatpak_runtime = "org.gnome.Platform" flatpak_runtime_version = "48" flatpak_sdk = "org.gnome.Sdk" -""", - "pyproject_table_windows": """\ +""" + ), + "pyproject_table_windows": ( + """\ requires = [ "toga-winforms~=0.5.0", ] -""", - "pyproject_table_iOS": """\ +""" + ), + "pyproject_table_iOS": ( + """\ requires = [ "toga-iOS~=0.5.0", "std-nslog~=1.0.3", ] -""", - "pyproject_table_android": '''\ +""" + ), + "pyproject_table_android": ( + '''\ requires = [ "toga-android~=0.5.0", ] @@ -241,12 +268,15 @@ def main(): # build_gradle_extra_content=""" # chaquopy.defaultConfig.staticProxy("toga_android.widgets.internal.webview") # """ -''', - "pyproject_table_web": """\ +''' + ), + "pyproject_table_web": ( + """\ requires = [ "toga-web~=0.5.0", ] -""", +""" + ), } @@ -266,19 +296,24 @@ def test_console_bootstrap(new_command): assert context == { "console_app": True, - "app_source": """\ + "app_source": ( + """\ def main(): # Your app logic goes here print("Hello, World.") -""", - "app_start_source": """\ +""" + ), + "app_start_source": ( + """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main() -""", - "pyproject_table_briefcase_app_extra_content": """ +""" + ), + "pyproject_table_briefcase_app_extra_content": ( + """ requires = [ # Add your cross-platform app requirements here ] @@ -287,19 +322,25 @@ def main(): "pytest", {% endif %} ] -""", - "pyproject_table_macOS": """\ +""" + ), + "pyproject_table_macOS": ( + """\ universal_build = true requires = [ # Add your macOS-specific app requirements here ] -""", - "pyproject_table_linux": """\ +""" + ), + "pyproject_table_linux": ( + """\ requires = [ # Add your Linux-specific app requirements here ] -""", - "pyproject_table_linux_system_debian": """\ +""" + ), + "pyproject_table_linux_system_debian": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -307,8 +348,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_rhel": """\ +""" + ), + "pyproject_table_linux_system_rhel": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -316,8 +359,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_suse": """\ +""" + ), + "pyproject_table_linux_system_suse": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -325,8 +370,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_arch": """\ +""" + ), + "pyproject_table_linux_system_arch": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -334,26 +381,37 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_flatpak": """\ +""" + ), + "pyproject_table_linux_flatpak": ( + """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""", - "pyproject_table_windows": """\ +""" + ), + "pyproject_table_windows": ( + """\ requires = [ # Add your Windows-specific app requirements here ] -""", - "pyproject_table_iOS": """\ +""" + ), + "pyproject_table_iOS": ( + """\ supported = false -""", - "pyproject_table_android": """\ +""" + ), + "pyproject_table_android": ( + """\ supported = false -""", - "pyproject_table_web": """\ +""" + ), + "pyproject_table_web": ( + """\ supported = false -""", +""" + ), } @@ -372,7 +430,8 @@ def test_pyside6_bootstrap(new_command): ) assert context == { - "app_source": """\ + "app_source": ( + """\ import importlib.metadata import sys @@ -409,8 +468,10 @@ def main(): app = QtWidgets.QApplication(sys.argv) main_window = {{ cookiecutter.class_name }}() sys.exit(app.exec()) -""", - "pyproject_table_briefcase_app_extra_content": """ +""" + ), + "pyproject_table_briefcase_app_extra_content": ( + """ requires = [ "PySide6-Essentials~=6.8", # "PySide6-Addons~=6.8", @@ -420,20 +481,26 @@ def main(): "pytest", {% endif %} ] -""", - "pyproject_table_macOS": """\ +""" + ), + "pyproject_table_macOS": ( + """\ universal_build = true # As of Pyside 6.8, PySide enforces a macOS 12 minimum on wheels. min_os_version = "12.0" requires = [ "std-nslog~=1.0.3", ] -""", - "pyproject_table_linux": """\ +""" + ), + "pyproject_table_linux": ( + """\ requires = [ ] -""", - "pyproject_table_linux_system_debian": """\ +""" + ), + "pyproject_table_linux_system_debian": ( + """\ system_requires = [ ] @@ -449,16 +516,20 @@ def main(): "libxcb-shape0", "libxkbcommon-x11-0", ] -""", - "pyproject_table_linux_system_rhel": """\ +""" + ), + "pyproject_table_linux_system_rhel": ( + """\ system_requires = [ ] system_runtime_requires = [ "qt6-qtbase-gui", ] -""", - "pyproject_table_linux_system_suse": """\ +""" + ), + "pyproject_table_linux_system_suse": ( + """\ system_requires = [ ] @@ -466,16 +537,20 @@ def main(): "libgthread-2_0-0", "libQt6Gui6", ] -""", - "pyproject_table_linux_system_arch": """\ +""" + ), + "pyproject_table_linux_system_arch": ( + """\ system_requires = [ ] system_runtime_requires = [ "qt6-base", ] -""", - "pyproject_table_linux_appimage": """\ +""" + ), + "pyproject_table_linux_appimage": ( + """\ manylinux = "manylinux_2_28" system_requires = [ @@ -484,25 +559,36 @@ def main(): linuxdeploy_plugins = [ ] -""", - "pyproject_table_linux_flatpak": """\ +""" + ), + "pyproject_table_linux_flatpak": ( + """\ flatpak_runtime = "org.kde.Platform" flatpak_runtime_version = "6.9" flatpak_sdk = "org.kde.Sdk" -""", - "pyproject_table_windows": """\ +""" + ), + "pyproject_table_windows": ( + """\ requires = [ ] -""", - "pyproject_table_iOS": """\ +""" + ), + "pyproject_table_iOS": ( + """\ supported = false -""", - "pyproject_table_android": """\ +""" + ), + "pyproject_table_android": ( + """\ supported = false -""", - "pyproject_table_web": """\ +""" + ), + "pyproject_table_web": ( + """\ supported = false -""", +""" + ), } @@ -521,7 +607,8 @@ def test_pygame_bootstrap(new_command): ) assert context == { - "app_source": """\ + "app_source": ( + """\ import importlib.metadata import os import sys @@ -565,8 +652,10 @@ def main(): pygame.display.flip() pygame.quit() -""", - "pyproject_table_briefcase_app_extra_content": """ +""" + ), + "pyproject_table_briefcase_app_extra_content": ( + """ requires = [ "pygame~=2.6", ] @@ -575,46 +664,60 @@ def main(): "pytest", {% endif %} ] -""", - "pyproject_table_macOS": """\ +""" + ), + "pyproject_table_macOS": ( + """\ universal_build = true requires = [ "std-nslog~=1.0.3", ] -""", - "pyproject_table_linux": """\ +""" + ), + "pyproject_table_linux": ( + """\ requires = [ ] -""", - "pyproject_table_linux_system_debian": """\ +""" + ), + "pyproject_table_linux_system_debian": ( + """\ system_requires = [ ] system_runtime_requires = [ ] -""", - "pyproject_table_linux_system_rhel": """\ +""" + ), + "pyproject_table_linux_system_rhel": ( + """\ system_requires = [ ] system_runtime_requires = [ ] -""", - "pyproject_table_linux_system_suse": """\ +""" + ), + "pyproject_table_linux_system_suse": ( + """\ system_requires = [ ] system_runtime_requires = [ ] -""", - "pyproject_table_linux_system_arch": """\ +""" + ), + "pyproject_table_linux_system_arch": ( + """\ system_requires = [ ] system_runtime_requires = [ ] -""", - "pyproject_table_linux_appimage": """\ +""" + ), + "pyproject_table_linux_appimage": ( + """\ manylinux = "manylinux_2_28" system_requires = [ @@ -622,25 +725,36 @@ def main(): linuxdeploy_plugins = [ ] -""", - "pyproject_table_linux_flatpak": """\ +""" + ), + "pyproject_table_linux_flatpak": ( + """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""", - "pyproject_table_windows": """\ +""" + ), + "pyproject_table_windows": ( + """\ requires = [ ] -""", - "pyproject_table_iOS": """\ +""" + ), + "pyproject_table_iOS": ( + """\ supported = false -""", - "pyproject_table_android": """\ +""" + ), + "pyproject_table_android": ( + """\ supported = false -""", - "pyproject_table_web": """\ +""" + ), + "pyproject_table_web": ( + """\ supported = false -""", +""" + ), } @@ -659,38 +773,49 @@ def test_no_bootstrap(new_command): ) assert context == { - "app_source": """\ + "app_source": ( + """\ def main(): # Your app logic goes here print("Hello, World.") -""", - "app_start_source": """\ +""" + ), + "app_start_source": ( + """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main() -""", - "pyproject_table_briefcase_app_extra_content": """ +""" + ), + "pyproject_table_briefcase_app_extra_content": ( + """ requires = [ # Add your cross-platform app requirements here ] test_requires = [ # Add your cross-platform test requirements here ] -""", - "pyproject_table_macOS": """\ +""" + ), + "pyproject_table_macOS": ( + """\ universal_build = true requires = [ # Add your macOS-specific app requirements here ] -""", - "pyproject_table_linux": """\ +""" + ), + "pyproject_table_linux": ( + """\ requires = [ # Add your Linux-specific app requirements here ] -""", - "pyproject_table_linux_system_debian": """\ +""" + ), + "pyproject_table_linux_system_debian": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -698,8 +823,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_rhel": """\ +""" + ), + "pyproject_table_linux_system_rhel": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -707,8 +834,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_suse": """\ +""" + ), + "pyproject_table_linux_system_suse": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -716,8 +845,10 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_system_arch": """\ +""" + ), + "pyproject_table_linux_system_arch": ( + """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -725,32 +856,43 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""", - "pyproject_table_linux_flatpak": """\ +""" + ), + "pyproject_table_linux_flatpak": ( + """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""", - "pyproject_table_windows": """\ +""" + ), + "pyproject_table_windows": ( + """\ requires = [ # Add your Windows-specific app requirements here ] -""", - "pyproject_table_iOS": """\ +""" + ), + "pyproject_table_iOS": ( + """\ requires = [ # Add your iOS-specific app requirements here ] -""", - "pyproject_table_android": """\ +""" + ), + "pyproject_table_android": ( + """\ requires = [ # Add your Android-specific app requirements here ] -""", - "pyproject_table_web": """\ +""" + ), + "pyproject_table_web": ( + """\ requires = [ # Add your web-specific app requirements here ] -""", +""" + ), } diff --git a/tests/commands/run/test_LogFilter.py b/tests/commands/run/test_LogFilter.py index 6fbd16374..5e8f99309 100644 --- a/tests/commands/run/test_LogFilter.py +++ b/tests/commands/run/test_LogFilter.py @@ -255,6 +255,7 @@ def clean_filter(line): assert log_filter.returncode is None assert not terminated else: - # The success/failure condition was detected, and the termination condition was processed + # The success/failure condition was detected, and the termination condition was + # processed assert log_filter.returncode == returncode assert terminated diff --git a/tests/commands/upgrade/test_call.py b/tests/commands/upgrade/test_call.py index f20a26ad0..56a187b70 100644 --- a/tests/commands/upgrade/test_call.py +++ b/tests/commands/upgrade/test_call.py @@ -36,8 +36,8 @@ def test_list_tools(upgrade_command, mock_tool_registry, capsys): tools=upgrade_command.tools, install=False ) - assert capsys.readouterr().out == ( - "\n" + assert ( + capsys.readouterr().out == "\n" "[upgrade] Briefcase is managing the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -63,8 +63,8 @@ def test_list_specific_tools(upgrade_command, mock_tool_registry, capsys): tools=upgrade_command.tools, install=False ) - assert capsys.readouterr().out == ( - "\n" + assert ( + capsys.readouterr().out == "\n" "[upgrade] Briefcase is managing the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -115,8 +115,8 @@ def test_upgrade_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert capsys.readouterr().out == ( - "\n" + assert ( + capsys.readouterr().out == "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -160,8 +160,8 @@ def test_upgrade_specific_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert capsys.readouterr().out == ( - "\n" + assert ( + capsys.readouterr().out == "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -194,7 +194,9 @@ def test_upgrade_unmanaged_tools(upgrade_command, mock_tool_registry, capsys): """If only unmanaged tools are requested to upgrade, error is raised.""" with pytest.raises( UpgradeToolError, - match=r"Briefcase is not managing not_installed, unmanaged, unmanaged_managed\.", + match=( + r"Briefcase is not managing not_installed, unmanaged, unmanaged_managed\." + ), ): upgrade_command(tool_list=["unmanaged", "unmanaged_managed", "not_installed"]) @@ -255,8 +257,9 @@ def test_upgrade_mixed_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert capsys.readouterr().out == ( - "Briefcase is not managing not_installed, unmanaged, unmanaged_managed.\n" + assert ( + capsys.readouterr().out + == "Briefcase is not managing not_installed, unmanaged, unmanaged_managed.\n" "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index cff1436a9..bb25f7de8 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -116,7 +116,10 @@ def test_unknown_command(): {}, ), ( - "new --template=path/to/template --template-branch=experiment -C version=\\'1.2.3\\' -C other=42", + ( + "new --template=path/to/template --template-branch=experiment -C" + " version=\\'1.2.3\\' -C other=42" + ), { "template": "path/to/template", "template_branch": "experiment", @@ -155,7 +158,10 @@ def test_new_command(macOS_console, cmdline, expected_options, expected_override {}, ), ( - "convert --template=path/to/template --template-branch=experiment -C version=\\'1.2.3\\' -C other=42", + ( + "convert --template=path/to/template --template-branch=experiment -C" + " version=\\'1.2.3\\' -C other=42" + ), { "template": "path/to/template", "template_branch": "experiment", @@ -545,7 +551,10 @@ def test_command_explicit_unsupported_format(monkeypatch, macOS_console): with pytest.raises( UnsupportedCommandError, - match=r"The create command for the macOS homebrew format has not been implemented \(yet!\).", + match=( + r"The create command for the macOS homebrew format has not been implemented" + r" \(yet!\)." + ), ): do_cmdline_parse("create macOS homebrew", macOS_console) From 8a2524afd65d874f0d6d5414219865dae692136d Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Mon, 16 Feb 2026 13:32:57 +0000 Subject: [PATCH 02/11] changes --- changes/2688.misc.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/2688.misc.md diff --git a/changes/2688.misc.md b/changes/2688.misc.md new file mode 100644 index 000000000..e3bc77cc8 --- /dev/null +++ b/changes/2688.misc.md @@ -0,0 +1 @@ +E501 linting issues have been resolved for the tests/commands folder From eeb2212ed36acb77a628433cf2516db03a46fb5a Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Mon, 16 Feb 2026 14:20:18 +0000 Subject: [PATCH 03/11] fix e501 for tests/console and tests/config --- pyproject.toml | 2 - tests/config/test_parse_config.py | 96 +++++++++----------------- tests/console/Console/test_textwrap.py | 96 ++++++++++++++++---------- tests/console/Console/test_wait_bar.py | 4 +- tests/console/test_Log.py | 30 ++++++-- tests/console/test_NotDeadYet.py | 5 +- 6 files changed, 119 insertions(+), 114 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index daed3f489..c77a8d1c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -270,8 +270,6 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes -"tests/config/*" = ["E501"] -"tests/console/*" = ["E501"] "tests/integrations/*" = ["E501"] "tests/platforms/*" = ["E501"] diff --git a/tests/config/test_parse_config.py b/tests/config/test_parse_config.py index d40b986ad..7fa4783b7 100644 --- a/tests/config/test_parse_config.py +++ b/tests/config/test_parse_config.py @@ -22,13 +22,11 @@ def test_invalid_toml(): def test_no_briefcase_section(): """If the config file doesn't contain a briefcase tool section, raise an error.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.section] name="value" number=42 - """ - ) + """) with pytest.raises(BriefcaseConfigError, match=r"No tool\.briefcase section"): parse_config( @@ -41,13 +39,11 @@ def test_no_briefcase_section(): def test_no_apps(): """If the config file doesn't contain at least one briefcase app, raise an error.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] name="value" number=42 - """ - ) + """) with pytest.raises(BriefcaseConfigError, match="No Briefcase apps defined"): parse_config( @@ -60,15 +56,13 @@ def test_no_apps(): def test_single_minimal_app(): """A single app can be defined, but can exist without any app attributes.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 42 license.file = "LICENSE" [tool.briefcase.app.my_app] - """ - ) + """) global_options, apps = parse_config( config_file, @@ -93,8 +87,7 @@ def test_single_minimal_app(): def test_multiple_minimal_apps(): """The configuration can contain multiple apps without an explicit tool header.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase.app.first] number=37 license.file = "LICENSE" @@ -103,8 +96,7 @@ def test_multiple_minimal_apps(): app_name="my_app" number=42 license.file = "LICENSE.txt" - """ - ) + """) global_options, apps = parse_config( config_file, @@ -130,8 +122,7 @@ def test_multiple_minimal_apps(): def test_platform_override(): """An app can define platform settings that override base settings.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 basevalue = "the base" @@ -152,8 +143,7 @@ def test_platform_override(): [tool.briefcase.app.other_app.macOS] value = 4 platformvalue = "other macos platform" - """ - ) + """) global_options, apps = parse_config( config_file, @@ -196,8 +186,7 @@ def test_platform_override(): def test_platform_override_ordering(): """The order of platform processing doesn't affect output.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 basevalue = "the base" @@ -218,8 +207,7 @@ def test_platform_override_ordering(): [tool.briefcase.app.other_app.macOS] value = 4 platformvalue = "other macos platform" - """ - ) + """) global_options, apps = parse_config( config_file, @@ -262,8 +250,7 @@ def test_platform_override_ordering(): def test_format_override(): """An app can define format settings that override base and platform settings.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 basevalue = "the base" @@ -300,8 +287,7 @@ def test_format_override(): [tool.briefcase.app.other_app.macOS.app] value = 41 formatvalue = "other macos app format" - """ - ) + """) global_options, apps = parse_config( config_file, @@ -345,8 +331,7 @@ def test_format_override(): def test_format_override_ordering(): """The order of format processing doesn't affect output.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 basevalue = "the base" @@ -383,8 +368,7 @@ def test_format_override_ordering(): [tool.briefcase.app.other_app.macOS.Xcode] value = 41 formatvalue = "other macos app format" - """ - ) + """) global_options, apps = parse_config( config_file, @@ -427,8 +411,7 @@ def test_format_override_ordering(): def test_requires(): """Requirements can be specified.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 requires = ["base value"] @@ -453,8 +436,7 @@ def test_requires(): requires = ["appimage value"] [tool.briefcase.app.other_app] - """ - ) + """) # Request a macOS app global_options, apps = parse_config( @@ -576,8 +558,7 @@ def test_requires(): def test_document_types(): """Document types can be specified.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 license.file = "LICENSE" @@ -596,8 +577,7 @@ def test_document_types(): [tool.briefcase.app.other_app] - """ - ) + """) # Request a macOS app _global_options, apps = parse_config( @@ -634,8 +614,7 @@ def test_document_types(): def test_pep621_defaults(): - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [project] name = "awesome" version = "1.2.3" @@ -671,8 +650,7 @@ def test_pep621_defaults(): "toga-cocoa~=0.3.1", "std-nslog~=1.0.3" ] - """ - ) + """) _global_options, apps = parse_config( config_file, @@ -703,16 +681,14 @@ def test_pep621_defaults(): def test_license_is_string_project(): """The project definition contains a string definition for 'license'.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 license = "Some license" [tool.briefcase.app.my_app] appvalue = "the app" - """ - ) + """) console = Mock() global_options, apps = parse_config( @@ -729,8 +705,7 @@ def test_license_is_string_project(): "appvalue": "the app", "license": {"file": "LICENSE"}, } - console.warning.assert_called_once_with( - """ + console.warning.assert_called_once_with(""" ************************************************************************* ** WARNING: License Definition for the Project is Deprecated ** ************************************************************************* @@ -753,14 +728,12 @@ def test_license_is_string_project(): license.file = "LICENSE" ************************************************************************* -""" - ) +""") def test_license_is_string_project_and_app(): """The project and app definition contain a string definition for 'license'.""" - config_file = BytesIO( - b""" + config_file = BytesIO(b""" [tool.briefcase] value = 0 license = "Some license" @@ -768,8 +741,7 @@ def test_license_is_string_project_and_app(): [tool.briefcase.app.my_app] appvalue = "the app" license = "Another license" - """ - ) + """) console = Mock() global_options, apps = parse_config( @@ -788,8 +760,7 @@ def test_license_is_string_project_and_app(): } console.warning.assert_has_calls( [ - call( - """ + call(""" ************************************************************************* ** WARNING: License Definition for the Project is Deprecated ** ************************************************************************* @@ -812,10 +783,8 @@ def test_license_is_string_project_and_app(): license.file = "LICENSE" ************************************************************************* -""" - ), - call( - """ +"""), + call(""" ************************************************************************* ** WARNING: License Definition for 'my_app' is Deprecated ** ************************************************************************* @@ -838,7 +807,6 @@ def test_license_is_string_project_and_app(): license.file = "LICENSE" ************************************************************************* -""" - ), +"""), ] ) diff --git a/tests/console/Console/test_textwrap.py b/tests/console/Console/test_textwrap.py index 33056d1f7..0207fe2f3 100644 --- a/tests/console/Console/test_textwrap.py +++ b/tests/console/Console/test_textwrap.py @@ -9,42 +9,50 @@ "There is nothing wrong with your television set.", ), ( - "There is nothing wrong with your television set.\n" - "Do not attempt to adjust the picture.", - "There is nothing wrong with your television set.\n" - "Do not attempt to adjust the picture.", + ( + "There is nothing wrong with your television set.\n" + "Do not attempt to adjust the picture." + ), + ( + "There is nothing wrong with your television set.\n" + "Do not attempt to adjust the picture." + ), ), ( - "There is nothing\n\n\nwrong with your television set.\n\n" - "Do not attempt to adjust the picture. We are controlling transmission. If we wish to make it louder, " - "we will bring\nup the volume.\n", - "There is nothing\n" - "\n" - "\n" - "wrong with your television set.\n" - "\n" - "Do not attempt to adjust the picture. We are controlling transmission. If we\n" - "wish to make it louder, we will bring\n" - "up the volume.", + ( + "There is nothing\n\n\nwrong with your television set.\n\nDo not" + " attempt to adjust the picture. We are controlling transmission. If we" + " wish to make it louder, we will bring\nup the volume.\n" + ), + ( + "There is nothing\n\n\nwrong with your television set.\n\nDo not" + " attempt to adjust the picture. We are controlling transmission. If" + " we\nwish to make it louder, we will bring\nup the volume." + ), ), ( - "There is nothing wrong with your television set. Do not " - "attempt to adjust the picture. We are controlling transmission. " - "If we wish to make it louder, we will bring up the volume. If " - "we wish to make it softer, we will tune it to " - "a whisper. We will control the horizontal. We will control the vertical. " - "We can roll the image, make it flutter. We can change the " - "focus to a soft blur or sharpen it to crystal clarity. For the next " - "hour, sit quietly, and we will control all that you see and hear. We repeat: There is nothing " - "wrong with your television set.", - "There is nothing wrong with your television set. Do not attempt to adjust the\n" - "picture. We are controlling transmission. If we wish to make it louder, we\n" - "will bring up the volume. If we wish to make it softer, we will tune it to a\n" - "whisper. We will control the horizontal. We will control the vertical. We can\n" - "roll the image, make it flutter. We can change the focus to a soft blur or\n" - "sharpen it to crystal clarity. For the next hour, sit quietly, and we will\n" - "control all that you see and hear. We repeat: There is nothing wrong with your\n" - "television set.", + ( + "There is nothing wrong with your television set. Do not attempt to" + " adjust the picture. We are controlling transmission. If we wish to" + " make it louder, we will bring up the volume. If we wish to make it" + " softer, we will tune it to a whisper. We will control the horizontal." + " We will control the vertical. We can roll the image, make it flutter." + " We can change the focus to a soft blur or sharpen it to crystal" + " clarity. For the next hour, sit quietly, and we will control all that" + " you see and hear. We repeat: There is nothing wrong with your" + " television set." + ), + ( + "There is nothing wrong with your television set. Do not attempt to" + " adjust the\npicture. We are controlling transmission. If we wish to" + " make it louder, we\nwill bring up the volume. If we wish to make it" + " softer, we will tune it to a\nwhisper. We will control the" + " horizontal. We will control the vertical. We can\nroll the image," + " make it flutter. We can change the focus to a soft blur or\nsharpen" + " it to crystal clarity. For the next hour, sit quietly, and we" + " will\ncontrol all that you see and hear. We repeat: There is nothing" + " wrong with your\ntelevision set." + ), ), ], ) @@ -64,15 +72,27 @@ def test_textwrap(console, in_text, out_text): ), ( 80, - "This is 83 characters long. This is 83 characters long. This is 83 characters long.", - "This is 83 characters long. This is 83 characters long. This is 83 characters\nlong.", + ( + "This is 83 characters long. This is 83 characters long. This is 83" + " characters long." + ), + ( + "This is 83 characters long. This is 83 characters long. This is 83" + " characters\nlong." + ), ), ( 120, - "This is 144 characters long. This is 144 characters long. This is 144 characters long. " - "This is 144 characters long. This is 144 characters long.", - "This is 144 characters long. This is 144 characters long. " - "This is 144 characters long. This is 144 characters long. This\nis 144 characters long.", + ( + "This is 144 characters long. This is 144 characters long. This is 144" + " characters long. This is 144 characters long. This is 144 characters" + " long." + ), + ( + "This is 144 characters long. This is 144 characters long. This is 144" + " characters long. This is 144 characters long. This\nis 144 characters" + " long." + ), ), ], ) diff --git a/tests/console/Console/test_wait_bar.py b/tests/console/Console/test_wait_bar.py index 8a593c826..f86960a21 100644 --- a/tests/console/Console/test_wait_bar.py +++ b/tests/console/Console/test_wait_bar.py @@ -18,8 +18,8 @@ def test_wait_bar_done_message_non_interactive(non_interactive_console, capsys): with non_interactive_console.wait_bar("Wait message...", done_message="finished"): pass - assert capsys.readouterr().out == ( - "Wait message... started\nWait message... finished\n" + assert ( + capsys.readouterr().out == "Wait message... started\nWait message... finished\n" ) diff --git a/tests/console/test_Log.py b/tests/console/test_Log.py index 70c3a7aca..2e1a650a1 100644 --- a/tests/console/test_Log.py +++ b/tests/console/test_Log.py @@ -476,7 +476,10 @@ def test_log_with_context(console, capsys): "this is info output", "", "Entering Deep context...", - "Deep| --------------------------------------------------------------------", + ( + "Deep|" + " --------------------------------------------------------------------" + ), "Deep| this is deep context", "Deep| ", "Deep| [prefix] prefixed deep context", @@ -484,17 +487,26 @@ def test_log_with_context(console, capsys): "Deep| this is deep debug", "Deep| ", "Deep| Entering Really Deep context...", - "Really Deep| -------------------------------------------------------------", + ( + "Really Deep|" + " -------------------------------------------------------------" + ), "Really Deep| this is really deep context", "Really Deep| ", "Really Deep| [prefix2] prefixed really deep context", "Really Deep| ", "Really Deep| this is really deep debug", - "Really Deep| -------------------------------------------------------------", + ( + "Really Deep|" + " -------------------------------------------------------------" + ), "Deep| Leaving Really Deep context.", "Deep| ", "Deep| Pop back to deep", - "Deep| --------------------------------------------------------------------", + ( + "Deep|" + " --------------------------------------------------------------------" + ), "Leaving Deep context.", "", "Pop back to normal", @@ -521,9 +533,15 @@ def test_log_error_with_context(console, capsys): "this is info output", "", "Entering Deep context...", - "Deep| --------------------------------------------------------------------", + ( + "Deep|" + " --------------------------------------------------------------------" + ), "Deep| this is deep context", - "Deep| --------------------------------------------------------------------", + ( + "Deep|" + " --------------------------------------------------------------------" + ), "Leaving Deep context.", "", "this is cleanup", diff --git a/tests/console/test_NotDeadYet.py b/tests/console/test_NotDeadYet.py index 89c087698..901bc3c3a 100644 --- a/tests/console/test_NotDeadYet.py +++ b/tests/console/test_NotDeadYet.py @@ -21,8 +21,9 @@ def test_update(capsys, monkeypatch, dummy_console): keep_alive.update() keep_alive.update() - assert capsys.readouterr().out == ( - "... still waiting\n... still waiting\n... still waiting\n" + assert ( + capsys.readouterr().out + == "... still waiting\n... still waiting\n... still waiting\n" ) From c8da2d313d650e9c566c61fd11d107bf52405209 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Mon, 16 Feb 2026 14:21:32 +0000 Subject: [PATCH 04/11] update --- changes/2688.misc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/2688.misc.md b/changes/2688.misc.md index e3bc77cc8..8f6f20dba 100644 --- a/changes/2688.misc.md +++ b/changes/2688.misc.md @@ -1 +1 @@ -E501 linting issues have been resolved for the tests/commands folder +E501 linting issues have been resolved for the tests/commands, tests/config and tests/console folder From e637047bc55420c9f14f5f17cc31e1f8af98ebd9 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Mon, 16 Feb 2026 14:28:34 +0000 Subject: [PATCH 05/11] fix precommit --- tests/config/test_merge_pep621_config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/config/test_merge_pep621_config.py b/tests/config/test_merge_pep621_config.py index 88d26d756..1c8e1ecd9 100644 --- a/tests/config/test_merge_pep621_config.py +++ b/tests/config/test_merge_pep621_config.py @@ -79,7 +79,8 @@ def test_missing_subkeys(): def test_specified_license_file(): - "The license file is included in the briefcase config if specified in the PEP621 config" + """The license file is included in the briefcase config if specified in the PEP621 + config.""" briefcase_config = {"key": "value"} merge_pep621_config( @@ -290,7 +291,8 @@ def test_dependencies_with_requires(): def test_no_test_dependencies(): - "If the global config doesn't specify test dependencies, test_requires are used as is" + """If the global config doesn't specify test dependencies,test_requires are used as + is.""" briefcase_config = {"key": "value", "test_requires": ["first", "second"]} merge_pep621_config( @@ -320,7 +322,8 @@ def test_optional_non_test_dependencies(): def test_test_dependencies_without_requires(): - "If the global config doesn't specify test requirements, test dependencies are used as is" + """If the global config doesn't specify test requirements, test " "dependencies are + used as is.""" briefcase_config = {"key": "value"} merge_pep621_config( From 3ed0652ee343ecdcd726c672f4b1aa721c19596c Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Tue, 17 Feb 2026 20:52:52 +0000 Subject: [PATCH 06/11] fix --- pyproject.toml | 19 +++++++++++++-- .../base/test_update_cookiecutter_cache.py | 24 ++++++++++++------- tests/commands/create/test_create_app.py | 21 +++++++++++----- .../create/test_install_stub_binary.py | 8 +++++-- tests/commands/upgrade/test_call.py | 21 ++++++++-------- tests/config/test_merge_pep621_config.py | 2 +- 6 files changed, 65 insertions(+), 30 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c77a8d1c1..da8a1bdf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -270,8 +270,23 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes -"tests/integrations/*" = ["E501"] -"tests/platforms/*" = ["E501"] +"tests/integrations/android_sdk/*" = ["E501"] +"tests/integrations/cookieCutter/*" = ["E501"] +"tests/integrations/flatpak/*" = ["E501"] +"tests/integrations/git/*" = ["E501"] +"tests/integrations/java/*" = ["E501"] +"tests/integrations/linuxdeploy/*" = ["E501"] +"tests/integrations/rcedit/*" = ["E501"] +"tests/integrations/subprocess/*" = ["E501"] +"tests/integrations/visualstudio/*" = ["E501"] +"tests/integrations/windows_sdk/*" = ["E501"] +"tests/integrations/xcode/*" = ["E501"] +"tests/platforms/android/*" = ["E501"] +"tests/platforms/iOS/*" = ["E501"] +"tests/platforms/linux/*" = ["E501"] +"tests/platforms/macOS/*" = ["E501"] +"tests/platforms/web/*" = ["E501"] +"tests/platforms/windows/*" = ["E501"] [tool.rumdl] diff --git a/tests/commands/base/test_update_cookiecutter_cache.py b/tests/commands/base/test_update_cookiecutter_cache.py index ffba2def6..82d33267f 100644 --- a/tests/commands/base/test_update_cookiecutter_cache.py +++ b/tests/commands/base/test_update_cookiecutter_cache.py @@ -132,28 +132,36 @@ def test_new_repo_invalid_template_url(base_command, mock_git): ("stderr_string", "error_message"), [ pytest.param( - "\n stderr: '\nfatal: could not clone repository" - " 'https://example.com' \n'", + ( + "\n stderr: '\nfatal: could not clone repository" + " 'https://example.com' \n'" + ), "Could not clone repository 'https://example.com'.", id="tailing-whitespace-no-caps-no-period", ), pytest.param( - "\n stderr: '\nfatal: Could not read from remote repository.\n\nPlease" - " make sure you have the correct access rights\nand the repository" - " exists. \n'", + ( + """\n stderr: '\nfatal: Could not read from remote repository. + \n\nPlease""" + " make sure you have the correct access rights\nand the repository" + " exists. \n'" + ), "Could not read from remote repository.\n\nPlease make sure " "you have the correct access rights\nand the repository exists.", id="tailing-whitespace-has-caps-has-period", ), pytest.param( - "\n stderr: '\nfatal: unable to access 'https://example.com/': " - "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal error'", + ( + "\n stderr: '\nfatal: unable to access 'https://example.com/': " + "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal" + "error'" + ), "Unable to access 'https://example.com/': OpenSSL/3.2.2: " "error:0A000438:SSL routines::tlsv1 alert internal error.", id="no-tailing-whitespace-no-caps-no-period", ), pytest.param( - "\n stderr: 'Mysterious git clone edge case with no fatal error.", + ("\n stderr: 'Mysterious git clone edge case with no fatal error."), "This may be because your computer is offline", id="fallback-hint", ), diff --git a/tests/commands/create/test_create_app.py b/tests/commands/create/test_create_app.py index 1d9bbbbf1..db6ed8519 100644 --- a/tests/commands/create/test_create_app.py +++ b/tests/commands/create/test_create_app.py @@ -49,8 +49,11 @@ def test_create_existing_app_overwrite(tracking_create_command, tmp_path): # Input was required by the user assert tracking_create_command.console.prompts == [ - f"The directory {bundle_path.relative_to(base_path)} already exists; overwrite" - " [y/N]? " + ( + f"The directory {bundle_path.relative_to(base_path)} already exists;" + " overwrite" + " [y/N]? " + ), ] # The right sequence of things will be done @@ -86,8 +89,11 @@ def test_create_existing_app_no_overwrite(tracking_create_command, tmp_path): # Input was required by the user assert tracking_create_command.console.prompts == [ - f"The directory {bundle_path.relative_to(base_path)} already exists; overwrite" - " [y/N]? " + ( + f"The directory {bundle_path.relative_to(base_path)} already exists;" + " overwrite" + " [y/N]? " + ), ] # No app creation actions will be performed @@ -115,8 +121,11 @@ def test_create_existing_app_no_overwrite_default(tracking_create_command, tmp_p # Input was required by the user assert tracking_create_command.console.prompts == [ - f"The directory {bundle_path.relative_to(base_path)} already exists; overwrite" - " [y/N]? " + ( + f"The directory {bundle_path.relative_to(base_path)} already exists;" + " overwrite" + " [y/N]? " + ), ] # And no actions were necessary diff --git a/tests/commands/create/test_install_stub_binary.py b/tests/commands/create/test_install_stub_binary.py index 6d2acd7a0..e73a593af 100644 --- a/tests/commands/create/test_install_stub_binary.py +++ b/tests/commands/create/test_install_stub_binary.py @@ -264,8 +264,12 @@ def test_install_custom_stub_binary_url( # Confirm the right file was unpacked create_command.tools.shutil.unpack_archive.assert_called_with( - filename=tmp_path - / "data/stub/986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb/My-Stub.zip", # noqa: E501 + filename=( + tmp_path + / "data/stub" + / "986428ef9d5a1852fc15d4367f19aa328ad530686056e9d83cdde03407c0bceb" + / "My-Stub.zip" + ), extract_dir=tmp_path / "base_path/build/my-app/tester/dummy", ) diff --git a/tests/commands/upgrade/test_call.py b/tests/commands/upgrade/test_call.py index 56a187b70..cb58ee73e 100644 --- a/tests/commands/upgrade/test_call.py +++ b/tests/commands/upgrade/test_call.py @@ -36,8 +36,8 @@ def test_list_tools(upgrade_command, mock_tool_registry, capsys): tools=upgrade_command.tools, install=False ) - assert ( - capsys.readouterr().out == "\n" + assert capsys.readouterr().out == ( + "\n" "[upgrade] Briefcase is managing the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -63,8 +63,8 @@ def test_list_specific_tools(upgrade_command, mock_tool_registry, capsys): tools=upgrade_command.tools, install=False ) - assert ( - capsys.readouterr().out == "\n" + assert capsys.readouterr().out == ( + "\n" "[upgrade] Briefcase is managing the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -115,8 +115,8 @@ def test_upgrade_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert ( - capsys.readouterr().out == "\n" + assert capsys.readouterr().out == ( + "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -160,8 +160,8 @@ def test_upgrade_specific_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert ( - capsys.readouterr().out == "\n" + assert capsys.readouterr().out == ( + "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" " - Managed Dummy Tool 2 (managed_2)\n" @@ -257,9 +257,8 @@ def test_upgrade_mixed_tools(upgrade_command, mock_tool_registry, capsys): "install", ] - assert ( - capsys.readouterr().out - == "Briefcase is not managing not_installed, unmanaged, unmanaged_managed.\n" + assert capsys.readouterr().out == ( + "Briefcase is not managing not_installed, unmanaged, unmanaged_managed.\n" "\n" "[upgrade] Briefcase will upgrade the following tools:\n" " - Managed Dummy Tool 1 (managed_1)\n" diff --git a/tests/config/test_merge_pep621_config.py b/tests/config/test_merge_pep621_config.py index 1c8e1ecd9..536bd248f 100644 --- a/tests/config/test_merge_pep621_config.py +++ b/tests/config/test_merge_pep621_config.py @@ -322,7 +322,7 @@ def test_optional_non_test_dependencies(): def test_test_dependencies_without_requires(): - """If the global config doesn't specify test requirements, test " "dependencies are + """If the global config doesn't specify test requirements, test dependencies are used as is.""" briefcase_config = {"key": "value"} From 6cd048bfb37f1131348417e836f7b7af44a95121 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Tue, 17 Feb 2026 20:56:51 +0000 Subject: [PATCH 07/11] fix --- pyproject.toml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index da8a1bdf5..c77a8d1c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -270,23 +270,8 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # E501: line too long, to be fixed in future changes -"tests/integrations/android_sdk/*" = ["E501"] -"tests/integrations/cookieCutter/*" = ["E501"] -"tests/integrations/flatpak/*" = ["E501"] -"tests/integrations/git/*" = ["E501"] -"tests/integrations/java/*" = ["E501"] -"tests/integrations/linuxdeploy/*" = ["E501"] -"tests/integrations/rcedit/*" = ["E501"] -"tests/integrations/subprocess/*" = ["E501"] -"tests/integrations/visualstudio/*" = ["E501"] -"tests/integrations/windows_sdk/*" = ["E501"] -"tests/integrations/xcode/*" = ["E501"] -"tests/platforms/android/*" = ["E501"] -"tests/platforms/iOS/*" = ["E501"] -"tests/platforms/linux/*" = ["E501"] -"tests/platforms/macOS/*" = ["E501"] -"tests/platforms/web/*" = ["E501"] -"tests/platforms/windows/*" = ["E501"] +"tests/integrations/*" = ["E501"] +"tests/platforms/*" = ["E501"] [tool.rumdl] From 51fdfbf65dcce9f08056750dce13ef15e87ca22b Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Wed, 25 Feb 2026 04:28:19 +0000 Subject: [PATCH 08/11] fix --- tests/commands/base/test_update_cookiecutter_cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/commands/base/test_update_cookiecutter_cache.py b/tests/commands/base/test_update_cookiecutter_cache.py index 82d33267f..e37428187 100644 --- a/tests/commands/base/test_update_cookiecutter_cache.py +++ b/tests/commands/base/test_update_cookiecutter_cache.py @@ -141,8 +141,8 @@ def test_new_repo_invalid_template_url(base_command, mock_git): ), pytest.param( ( - """\n stderr: '\nfatal: Could not read from remote repository. - \n\nPlease""" + "\n stderr: '\nfatal: Could not read from remote repository." + "\n\nPlease" " make sure you have the correct access rights\nand the repository" " exists. \n'" ), @@ -153,7 +153,7 @@ def test_new_repo_invalid_template_url(base_command, mock_git): pytest.param( ( "\n stderr: '\nfatal: unable to access 'https://example.com/': " - "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal" + "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal " "error'" ), "Unable to access 'https://example.com/': OpenSSL/3.2.2: " From d82dc34b5eb926dfcfedd7d42d29617c034168a8 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Thu, 5 Mar 2026 02:41:07 +0000 Subject: [PATCH 09/11] fix linting --- tests/commands/publish/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/commands/publish/conftest.py b/tests/commands/publish/conftest.py index 220035904..daf63684a 100644 --- a/tests/commands/publish/conftest.py +++ b/tests/commands/publish/conftest.py @@ -63,7 +63,8 @@ def publish_app(self, app, channel, **kwargs): return full_options({"publish_state": app.app_name}, kwargs) # These commands override the default behavior, simply tracking that - # they were invoked, rather than instantiating a Create/Update/Build command. + # they were invoked, rather than instantiating a Create/Update/Build + # command. # This is for testing purposes. def create_command(self, app, **kwargs): self.actions.append(("create", app.app_name, kwargs.copy())) From 38dd8c5dd25fe64c8c776f370abe277f4240bf59 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Thu, 5 Mar 2026 03:15:19 +0000 Subject: [PATCH 10/11] fix linting --- tests/commands/publish/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/commands/publish/conftest.py b/tests/commands/publish/conftest.py index f7525b512..c40d7f673 100644 --- a/tests/commands/publish/conftest.py +++ b/tests/commands/publish/conftest.py @@ -82,7 +82,7 @@ def _get_channels(self): } # These commands override the default behavior, simply tracking that - # they were invoked, rather than instantiating a Create/Update/Build + # they were invoked, rather than instantiating a Create/Update/Build # command. # This is for testing purposes. def package_command(self, app, **kwargs): From 719f835a1766bc6130fd664cbba3a3dd54b32c69 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 5 Mar 2026 11:52:34 +0800 Subject: [PATCH 11/11] Final touch ups. --- .../base/test_update_cookiecutter_cache.py | 14 +- tests/commands/create/test_create_app.py | 9 +- tests/commands/new/test_build_gui_context.py | 420 ++++++------------ tests/console/test_NotDeadYet.py | 5 +- 4 files changed, 154 insertions(+), 294 deletions(-) diff --git a/tests/commands/base/test_update_cookiecutter_cache.py b/tests/commands/base/test_update_cookiecutter_cache.py index e37428187..1dc0a157f 100644 --- a/tests/commands/base/test_update_cookiecutter_cache.py +++ b/tests/commands/base/test_update_cookiecutter_cache.py @@ -146,8 +146,10 @@ def test_new_repo_invalid_template_url(base_command, mock_git): " make sure you have the correct access rights\nand the repository" " exists. \n'" ), - "Could not read from remote repository.\n\nPlease make sure " - "you have the correct access rights\nand the repository exists.", + ( + "Could not read from remote repository.\n\nPlease make sure " + "you have the correct access rights\nand the repository exists." + ), id="tailing-whitespace-has-caps-has-period", ), pytest.param( @@ -156,12 +158,14 @@ def test_new_repo_invalid_template_url(base_command, mock_git): "OpenSSL/3.2.2: error:0A000438:SSL routines::tlsv1 alert internal " "error'" ), - "Unable to access 'https://example.com/': OpenSSL/3.2.2: " - "error:0A000438:SSL routines::tlsv1 alert internal error.", + ( + "Unable to access 'https://example.com/': OpenSSL/3.2.2: " + "error:0A000438:SSL routines::tlsv1 alert internal error." + ), id="no-tailing-whitespace-no-caps-no-period", ), pytest.param( - ("\n stderr: 'Mysterious git clone edge case with no fatal error."), + "\n stderr: 'Mysterious git clone edge case with no fatal error.", "This may be because your computer is offline", id="fallback-hint", ), diff --git a/tests/commands/create/test_create_app.py b/tests/commands/create/test_create_app.py index db6ed8519..8c45d8036 100644 --- a/tests/commands/create/test_create_app.py +++ b/tests/commands/create/test_create_app.py @@ -51,8 +51,7 @@ def test_create_existing_app_overwrite(tracking_create_command, tmp_path): assert tracking_create_command.console.prompts == [ ( f"The directory {bundle_path.relative_to(base_path)} already exists;" - " overwrite" - " [y/N]? " + " overwrite [y/N]? " ), ] @@ -91,8 +90,7 @@ def test_create_existing_app_no_overwrite(tracking_create_command, tmp_path): assert tracking_create_command.console.prompts == [ ( f"The directory {bundle_path.relative_to(base_path)} already exists;" - " overwrite" - " [y/N]? " + " overwrite [y/N]? " ), ] @@ -123,8 +121,7 @@ def test_create_existing_app_no_overwrite_default(tracking_create_command, tmp_p assert tracking_create_command.console.prompts == [ ( f"The directory {bundle_path.relative_to(base_path)} already exists;" - " overwrite" - " [y/N]? " + " overwrite [y/N]? " ), ] diff --git a/tests/commands/new/test_build_gui_context.py b/tests/commands/new/test_build_gui_context.py index 858573729..b2e413f03 100644 --- a/tests/commands/new/test_build_gui_context.py +++ b/tests/commands/new/test_build_gui_context.py @@ -38,8 +38,7 @@ def test_toga_bootstrap(new_command): ) assert context == { - "app_source": ( - '''\ + "app_source": '''\ import toga from toga.style.pack import COLUMN, ROW @@ -61,18 +60,14 @@ def startup(self): def main(): return {{ cookiecutter.class_name }}() -''' - ), - "app_start_source": ( - """\ +''', + "app_start_source": """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main().main_loop() -""" - ), - "pyproject_table_briefcase_app_extra_content": ( - """ +""", + "pyproject_table_briefcase_app_extra_content": """ requires = [ ] test_requires = [ @@ -80,19 +75,15 @@ def main(): "pytest", {% endif %} ] -""" - ), - "pyproject_table_macOS": ( - """\ +""", + "pyproject_table_macOS": """\ universal_build = true requires = [ "toga-cocoa~=0.5.0", "std-nslog~=1.0.3", ] -""" - ), - "pyproject_table_linux": ( - """\ +""", + "pyproject_table_linux": """\ requires = [ "toga-gtk~=0.5.0", # PyGObject 3.52.1 enforces a requirement on libgirepository-2.0-dev. This library @@ -100,10 +91,8 @@ def main(): # older) releases, you can remove this version pin. See beeware/toga#3143. "pygobject < 3.52.1", ] -""" - ), - "pyproject_table_linux_system_debian": ( - """\ +""", + "pyproject_table_linux_system_debian": """\ system_requires = [ # Needed to compile pycairo wheel "libcairo2-dev", @@ -128,10 +117,8 @@ def main(): # Note: Debian 11 requires gir1.2-webkit2-4.0 instead # "gir1.2-webkit2-4.1", ] -""" - ), - "pyproject_table_linux_system_rhel": ( - """\ +""", + "pyproject_table_linux_system_rhel": """\ system_requires = [ # Needed to compile pycairo wheel "cairo-gobject-devel", @@ -149,10 +136,8 @@ def main(): # Needed to provide WebKit2 at runtime # "webkit2gtk3", ] -""" - ), - "pyproject_table_linux_system_suse": ( - """\ +""", + "pyproject_table_linux_system_suse": """\ system_requires = [ # Needed to compile pycairo wheel "cairo-devel", @@ -170,10 +155,8 @@ def main(): # Needed to provide WebKit2 at runtime # "libwebkit2gtk3", "typelib(WebKit2)", ] -""" - ), - "pyproject_table_linux_system_arch": ( - """\ +""", + "pyproject_table_linux_system_arch": """\ system_requires = [ # Needed to compile pycairo wheel "cairo", @@ -199,10 +182,8 @@ def main(): # Needed to provide WebKit2 at runtime # "webkit2gtk", ] -""" - ), - "pyproject_table_linux_appimage": ( - """\ +""", + "pyproject_table_linux_appimage": """\ manylinux = "manylinux_2_28" system_requires = [ @@ -222,32 +203,24 @@ def main(): linuxdeploy_plugins = [ "DEPLOY_GTK_VERSION=3 gtk", ] -""" - ), - "pyproject_table_linux_flatpak": ( - """\ +""", + "pyproject_table_linux_flatpak": """\ flatpak_runtime = "org.gnome.Platform" flatpak_runtime_version = "48" flatpak_sdk = "org.gnome.Sdk" -""" - ), - "pyproject_table_windows": ( - """\ +""", + "pyproject_table_windows": """\ requires = [ "toga-winforms~=0.5.0", ] -""" - ), - "pyproject_table_iOS": ( - """\ +""", + "pyproject_table_iOS": """\ requires = [ "toga-iOS~=0.5.0", "std-nslog~=1.0.3", ] -""" - ), - "pyproject_table_android": ( - '''\ +""", + "pyproject_table_android": '''\ requires = [ "toga-android~=0.5.0", ] @@ -268,15 +241,12 @@ def main(): # build_gradle_extra_content=""" # chaquopy.defaultConfig.staticProxy("toga_android.widgets.internal.webview") # """ -''' - ), - "pyproject_table_web": ( - """\ +''', + "pyproject_table_web": """\ requires = [ "toga-web~=0.5.0", ] -""" - ), +""", } @@ -304,16 +274,13 @@ def main(): print("Hello, World.") """ ), - "app_start_source": ( - """\ + "app_start_source": """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main() -""" - ), - "pyproject_table_briefcase_app_extra_content": ( - """ +""", + "pyproject_table_briefcase_app_extra_content": """ requires = [ # Add your cross-platform app requirements here ] @@ -322,25 +289,19 @@ def main(): "pytest", {% endif %} ] -""" - ), - "pyproject_table_macOS": ( - """\ +""", + "pyproject_table_macOS": """\ universal_build = true requires = [ # Add your macOS-specific app requirements here ] -""" - ), - "pyproject_table_linux": ( - """\ +""", + "pyproject_table_linux": """\ requires = [ # Add your Linux-specific app requirements here ] -""" - ), - "pyproject_table_linux_system_debian": ( - """\ +""", + "pyproject_table_linux_system_debian": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -348,10 +309,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_rhel": ( - """\ +""", + "pyproject_table_linux_system_rhel": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -359,10 +318,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_suse": ( - """\ +""", + "pyproject_table_linux_system_suse": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -370,10 +327,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_arch": ( - """\ +""", + "pyproject_table_linux_system_arch": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -381,37 +336,26 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_flatpak": ( - """\ +""", + "pyproject_table_linux_flatpak": """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""" - ), - "pyproject_table_windows": ( - """\ +""", + "pyproject_table_windows": """\ requires = [ # Add your Windows-specific app requirements here ] -""" - ), - "pyproject_table_iOS": ( - """\ +""", + "pyproject_table_iOS": """\ supported = false -""" - ), - "pyproject_table_android": ( - """\ +""", + "pyproject_table_android": """\ supported = false -""" - ), - "pyproject_table_web": ( - """\ +""", + "pyproject_table_web": """\ supported = false -""" - ), +""", } @@ -430,8 +374,7 @@ def test_pyside6_bootstrap(new_command): ) assert context == { - "app_source": ( - """\ + "app_source": """\ import importlib.metadata import sys @@ -468,10 +411,8 @@ def main(): app = QtWidgets.QApplication(sys.argv) main_window = {{ cookiecutter.class_name }}() sys.exit(app.exec()) -""" - ), - "pyproject_table_briefcase_app_extra_content": ( - """ +""", + "pyproject_table_briefcase_app_extra_content": """ requires = [ "PySide6-Essentials~=6.8", # "PySide6-Addons~=6.8", @@ -481,26 +422,20 @@ def main(): "pytest", {% endif %} ] -""" - ), - "pyproject_table_macOS": ( - """\ +""", + "pyproject_table_macOS": """\ universal_build = true # As of Pyside 6.8, PySide enforces a macOS 12 minimum on wheels. min_os_version = "12.0" requires = [ "std-nslog~=1.0.3", ] -""" - ), - "pyproject_table_linux": ( - """\ +""", + "pyproject_table_linux": """\ requires = [ ] -""" - ), - "pyproject_table_linux_system_debian": ( - """\ +""", + "pyproject_table_linux_system_debian": """\ system_requires = [ ] @@ -516,20 +451,16 @@ def main(): "libxcb-shape0", "libxkbcommon-x11-0", ] -""" - ), - "pyproject_table_linux_system_rhel": ( - """\ +""", + "pyproject_table_linux_system_rhel": """\ system_requires = [ ] system_runtime_requires = [ "qt6-qtbase-gui", ] -""" - ), - "pyproject_table_linux_system_suse": ( - """\ +""", + "pyproject_table_linux_system_suse": """\ system_requires = [ ] @@ -537,20 +468,16 @@ def main(): "libgthread-2_0-0", "libQt6Gui6", ] -""" - ), - "pyproject_table_linux_system_arch": ( - """\ +""", + "pyproject_table_linux_system_arch": """\ system_requires = [ ] system_runtime_requires = [ "qt6-base", ] -""" - ), - "pyproject_table_linux_appimage": ( - """\ +""", + "pyproject_table_linux_appimage": """\ manylinux = "manylinux_2_28" system_requires = [ @@ -559,36 +486,25 @@ def main(): linuxdeploy_plugins = [ ] -""" - ), - "pyproject_table_linux_flatpak": ( - """\ +""", + "pyproject_table_linux_flatpak": """\ flatpak_runtime = "org.kde.Platform" flatpak_runtime_version = "6.9" flatpak_sdk = "org.kde.Sdk" -""" - ), - "pyproject_table_windows": ( - """\ +""", + "pyproject_table_windows": """\ requires = [ ] -""" - ), - "pyproject_table_iOS": ( - """\ +""", + "pyproject_table_iOS": """\ supported = false -""" - ), - "pyproject_table_android": ( - """\ +""", + "pyproject_table_android": """\ supported = false -""" - ), - "pyproject_table_web": ( - """\ +""", + "pyproject_table_web": """\ supported = false -""" - ), +""", } @@ -607,8 +523,7 @@ def test_pygame_bootstrap(new_command): ) assert context == { - "app_source": ( - """\ + "app_source": """\ import importlib.metadata import os import sys @@ -652,10 +567,8 @@ def main(): pygame.display.flip() pygame.quit() -""" - ), - "pyproject_table_briefcase_app_extra_content": ( - """ +""", + "pyproject_table_briefcase_app_extra_content": """ requires = [ "pygame~=2.6", ] @@ -664,60 +577,46 @@ def main(): "pytest", {% endif %} ] -""" - ), - "pyproject_table_macOS": ( - """\ +""", + "pyproject_table_macOS": """\ universal_build = true requires = [ "std-nslog~=1.0.3", ] -""" - ), - "pyproject_table_linux": ( - """\ +""", + "pyproject_table_linux": """\ requires = [ ] -""" - ), - "pyproject_table_linux_system_debian": ( - """\ +""", + "pyproject_table_linux_system_debian": """\ system_requires = [ ] system_runtime_requires = [ ] -""" - ), - "pyproject_table_linux_system_rhel": ( - """\ +""", + "pyproject_table_linux_system_rhel": """\ system_requires = [ ] system_runtime_requires = [ ] -""" - ), - "pyproject_table_linux_system_suse": ( - """\ +""", + "pyproject_table_linux_system_suse": """\ system_requires = [ ] system_runtime_requires = [ ] -""" - ), - "pyproject_table_linux_system_arch": ( - """\ +""", + "pyproject_table_linux_system_arch": """\ system_requires = [ ] system_runtime_requires = [ ] -""" - ), - "pyproject_table_linux_appimage": ( - """\ +""", + "pyproject_table_linux_appimage": """\ manylinux = "manylinux_2_28" system_requires = [ @@ -725,36 +624,25 @@ def main(): linuxdeploy_plugins = [ ] -""" - ), - "pyproject_table_linux_flatpak": ( - """\ +""", + "pyproject_table_linux_flatpak": """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""" - ), - "pyproject_table_windows": ( - """\ +""", + "pyproject_table_windows": """\ requires = [ ] -""" - ), - "pyproject_table_iOS": ( - """\ +""", + "pyproject_table_iOS": """\ supported = false -""" - ), - "pyproject_table_android": ( - """\ +""", + "pyproject_table_android": """\ supported = false -""" - ), - "pyproject_table_web": ( - """\ +""", + "pyproject_table_web": """\ supported = false -""" - ), +""", } @@ -773,49 +661,38 @@ def test_no_bootstrap(new_command): ) assert context == { - "app_source": ( - """\ + "app_source": """\ def main(): # Your app logic goes here print("Hello, World.") -""" - ), - "app_start_source": ( - """\ +""", + "app_start_source": """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": main() -""" - ), - "pyproject_table_briefcase_app_extra_content": ( - """ +""", + "pyproject_table_briefcase_app_extra_content": """ requires = [ # Add your cross-platform app requirements here ] test_requires = [ # Add your cross-platform test requirements here ] -""" - ), - "pyproject_table_macOS": ( - """\ +""", + "pyproject_table_macOS": """\ universal_build = true requires = [ # Add your macOS-specific app requirements here ] -""" - ), - "pyproject_table_linux": ( - """\ +""", + "pyproject_table_linux": """\ requires = [ # Add your Linux-specific app requirements here ] -""" - ), - "pyproject_table_linux_system_debian": ( - """\ +""", + "pyproject_table_linux_system_debian": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -823,10 +700,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_rhel": ( - """\ +""", + "pyproject_table_linux_system_rhel": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -834,10 +709,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_suse": ( - """\ +""", + "pyproject_table_linux_system_suse": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -845,10 +718,8 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_system_arch": ( - """\ +""", + "pyproject_table_linux_system_arch": """\ system_requires = [ # Add any system packages needed at build the app here ] @@ -856,43 +727,32 @@ def main(): system_runtime_requires = [ # Add any system packages needed at runtime here ] -""" - ), - "pyproject_table_linux_flatpak": ( - """\ +""", + "pyproject_table_linux_flatpak": """\ flatpak_runtime = "org.freedesktop.Platform" flatpak_runtime_version = "25.08" flatpak_sdk = "org.freedesktop.Sdk" -""" - ), - "pyproject_table_windows": ( - """\ +""", + "pyproject_table_windows": """\ requires = [ # Add your Windows-specific app requirements here ] -""" - ), - "pyproject_table_iOS": ( - """\ +""", + "pyproject_table_iOS": """\ requires = [ # Add your iOS-specific app requirements here ] -""" - ), - "pyproject_table_android": ( - """\ +""", + "pyproject_table_android": """\ requires = [ # Add your Android-specific app requirements here ] -""" - ), - "pyproject_table_web": ( - """\ +""", + "pyproject_table_web": """\ requires = [ # Add your web-specific app requirements here ] -""" - ), +""", } diff --git a/tests/console/test_NotDeadYet.py b/tests/console/test_NotDeadYet.py index 901bc3c3a..89c087698 100644 --- a/tests/console/test_NotDeadYet.py +++ b/tests/console/test_NotDeadYet.py @@ -21,9 +21,8 @@ def test_update(capsys, monkeypatch, dummy_console): keep_alive.update() keep_alive.update() - assert ( - capsys.readouterr().out - == "... still waiting\n... still waiting\n... still waiting\n" + assert capsys.readouterr().out == ( + "... still waiting\n... still waiting\n... still waiting\n" )