From c99fe9c460973d0ac7cd348098ff55a34f8e80c0 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Thu, 26 Dec 2024 21:30:35 +0100 Subject: [PATCH] tests: utils: add onedir_only and onefile_only decorators Add `onedir_only` and `onefile_only` decorators to run the `pyi_builder` fixture in only the specified mode. Apply these decorators where applicable (i.e., in tests that were using the equivalent of these decorators, or that were checking `pyi_builder._mode` and calling `pytest.skip`). --- PyInstaller/utils/tests.py | 4 ++ tests/functional/test_basic.py | 48 +++++++------------ .../test_binary_vs_data_reclassification.py | 5 +- .../functional/test_macos_bundle_structure.py | 34 ++++++------- tests/functional/test_misc.py | 5 +- tests/functional/test_pkgutil.py | 13 ++--- tests/functional/test_pywin32.py | 4 +- tests/functional/test_qt.py | 10 ++-- tests/functional/test_scipy.py | 4 +- tests/functional/test_signals.py | 4 +- 10 files changed, 60 insertions(+), 71 deletions(-) diff --git a/PyInstaller/utils/tests.py b/PyInstaller/utils/tests.py index ccb78fb8494..4a0b9c78e40 100644 --- a/PyInstaller/utils/tests.py +++ b/PyInstaller/utils/tests.py @@ -26,6 +26,10 @@ xfail = pytest.mark.xfail skip = pytest.mark.skip +# Use these decorators to use the `pyi_builder` fixture only in onedir or only in onefile mode instead of both. +onedir_only = pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +onefile_only = pytest.mark.parametrize('pyi_builder', ['onefile'], indirect=True) + def importorskip(package: str): """ diff --git a/tests/functional/test_basic.py b/tests/functional/test_basic.py index 2a74fcb96fe..19ec5ff1bf4 100644 --- a/tests/functional/test_basic.py +++ b/tests/functional/test_basic.py @@ -20,7 +20,7 @@ import pytest from PyInstaller.compat import is_darwin, is_win -from PyInstaller.utils.tests import importorskip, skipif, xfail +from PyInstaller.utils.tests import importorskip, skipif, xfail, onedir_only, onefile_only def test_run_from_path_environ(pyi_builder): @@ -52,6 +52,7 @@ def _patch_spec(spec_name, symlink_name): pyi_builder_spec.test_spec(str(spec_file), app_name=symlink_name) +@onedir_only def test_pyz_as_external_file(pyi_builder, monkeypatch): # This tests the not well documented and seldom used feature of having the PYZ-archive in a separate file (.pkg). @@ -59,10 +60,6 @@ def MyEXE(*args, **kwargs): kwargs['append_pkg'] = False return EXE(*args, **kwargs) - # :todo: find a better way to not even run this test in onefile-mode - if pyi_builder._mode == 'onefile': - pytest.skip('only --onedir') - import PyInstaller.building.build_main EXE = PyInstaller.building.build_main.EXE monkeypatch.setattr('PyInstaller.building.build_main.EXE', MyEXE) @@ -628,25 +625,25 @@ def test_arbitrary_ext(pyi_builder): pyi_builder.test_script('pyi_arbitrary_ext.foo') +@onefile_only def test_option_runtime_tmpdir(pyi_builder): """ - Test to ensure that option `runtime_tmpdir` can be set and has effect. + Test to ensure that option `runtime_tmpdir` can be set and has effect. Applicable to onefile builds only. """ pyi_builder.test_source( """ - print('test - runtime_tmpdir - custom runtime temporary directory') import os import sys cwd = os.path.abspath(os.getcwd()) runtime_tmpdir = os.path.abspath(sys._MEIPASS) - # for onedir mode, runtime_tmpdir == cwd - # for onefile mode, os.path.dirname(runtime_tmpdir) == cwd - if not runtime_tmpdir == cwd and not os.path.dirname(runtime_tmpdir) == cwd: - raise SystemExit('Expected sys._MEIPASS to be under current working dir.' - ' sys._MEIPASS = ' + runtime_tmpdir + ', cwd = ' + cwd) - print('test - done') + + # With --runtime-tmpdir=., we expect the application to unpack itself into cwd/_MEIXXXX directory. + if os.path.dirname(runtime_tmpdir) != cwd: + raise SystemExit( + f'Expected sys._MEIPASS ({sys._MEIPASS}) to be under current working dir ({cwd}).' + ) """, # Set runtime-tmpdir to current working dir pyi_args=['--runtime-tmpdir', '.'] @@ -701,14 +698,12 @@ def test_pe_checksum(pyi_builder): assert header_sum.value == checksum.value +@onefile_only def test_onefile_longpath(pyi_builder, tmp_path): """ Verify that files with paths longer than 260 characters are correctly extracted from the onefile build. See issue #5615." """ - # The test is relevant only for onefile builds - if pyi_builder._mode != 'onefile': - pytest.skip('The test is relevant only to onefile builds.') # Create data file with secret _SECRET = 'LongDataPath' src_path = tmp_path / 'data.txt' @@ -854,13 +849,11 @@ def test_package_entry_point_name_collision(pyi_builder): assert re.findall("Running (.*) as (.*)", p.stdout) == expected +@onedir_only def test_contents_directory(pyi_builder): """ Test the --contents-directory option, including changing it without --clean. """ - if pyi_builder._mode != 'onedir': - pytest.skip('--contents-directory does not affect onefile builds.') - pyi_builder.test_source("", pyi_args=["--contents-directory", "foo"]) exe, = pyi_builder._find_executables("test_source") bundle = pathlib.Path(exe).parent @@ -874,13 +867,11 @@ def test_contents_directory(pyi_builder): pyi_builder.test_source("", pyi_args=["--contents-directory", "..", "--noconfirm"]) +@onedir_only def test_legacy_onedir_layout(pyi_builder): """ Test the --contents-directory=., which re-enables the legacy onedir layout. """ - if pyi_builder._mode != 'onedir': - pytest.skip('--contents-directory does not affect onefile builds.') - pyi_builder.test_source( """ import sys @@ -896,24 +887,21 @@ def test_legacy_onedir_layout(pyi_builder): ) -def test_spec_options(pyi_builder, spec_dir, capsys): - if pyi_builder._mode != 'onedir': - pytest.skip('spec file is onedir mode only') - - pyi_builder.test_spec( +def test_spec_options(pyi_builder_spec, spec_dir, capsys): + pyi_builder_spec.test_spec( spec_dir / "pyi_spec_options.spec", pyi_args=["--", "--optional-dependency", "email", "--optional-dependency", "gzip"] ) - exe, = pyi_builder._find_executables("pyi_spec_options") + exe, = pyi_builder_spec._find_executables("pyi_spec_options") p = subprocess.run([exe], stdout=subprocess.PIPE, encoding="utf-8") assert p.stdout == "Available dependencies: email gzip\n" capsys.readouterr() with pytest.raises(SystemExit) as ex: - pyi_builder.test_spec(spec_dir / "pyi_spec_options.spec", pyi_args=["--", "--help"]) + pyi_builder_spec.test_spec(spec_dir / "pyi_spec_options.spec", pyi_args=["--", "--help"]) assert ex.value.code == 0 assert "help blah blah blah" in capsys.readouterr().out with pytest.raises(SystemExit) as ex: - pyi_builder.test_spec(spec_dir / "pyi_spec_options.spec", pyi_args=["--", "--onefile"]) + pyi_builder_spec.test_spec(spec_dir / "pyi_spec_options.spec", pyi_args=["--", "--onefile"]) assert "pyi_spec_options.spec: error: unrecognized arguments: --onefile" in capsys.readouterr().err diff --git a/tests/functional/test_binary_vs_data_reclassification.py b/tests/functional/test_binary_vs_data_reclassification.py index dfbfd41dd86..03714a39a89 100644 --- a/tests/functional/test_binary_vs_data_reclassification.py +++ b/tests/functional/test_binary_vs_data_reclassification.py @@ -14,6 +14,7 @@ import pytest import PyInstaller.utils.misc as miscutils +from PyInstaller.utils.tests import onedir_only # Helpers @@ -60,7 +61,7 @@ def _create_test_build(pyi_builder, tmp_path, datas=None, binaries=None): @pytest.mark.linux @pytest.mark.win32 @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_automatic_reclassification_data_file(pyi_builder, tmp_path): binaries = [] @@ -86,7 +87,7 @@ def test_automatic_reclassification_data_file(pyi_builder, tmp_path): @pytest.mark.linux @pytest.mark.win32 @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_automatic_reclassification_binary(pyi_builder, tmp_path): datas = [] diff --git a/tests/functional/test_macos_bundle_structure.py b/tests/functional/test_macos_bundle_structure.py index a576a822910..6de299556bd 100644 --- a/tests/functional/test_macos_bundle_structure.py +++ b/tests/functional/test_macos_bundle_structure.py @@ -16,7 +16,7 @@ import pytest -from PyInstaller.utils.tests import importorskip +from PyInstaller.utils.tests import importorskip, onedir_only from PyInstaller.building.osx import DOT_REPLACEMENT # NOTE: the tests below explicitly enable the following environment variables: @@ -29,7 +29,7 @@ # Test that collected metadata is properly relocated to avoid codesign errors due to directory containing dots in name. @pytest.mark.darwin @importorskip('psutil') -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_signing_metadata(pyi_builder, monkeypatch): monkeypatch.setenv("PYINSTALLER_STRICT_BUNDLE_CODESIGN_ERROR", "1") monkeypatch.setenv("PYINSTALLER_VERIFY_BUNDLE_SIGNATURE", "1") @@ -42,7 +42,7 @@ def test_macos_bundle_signing_metadata(pyi_builder, monkeypatch): # Test that the bundle signing works even if we collect a package as source .py files, which we do not relocate. @pytest.mark.darwin @importorskip('psutil') -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_signing_py_files(pyi_builder, monkeypatch): monkeypatch.setenv("PYINSTALLER_STRICT_BUNDLE_CODESIGN_ERROR", "1") monkeypatch.setenv("PYINSTALLER_VERIFY_BUNDLE_SIGNATURE", "1") @@ -64,7 +64,7 @@ def AnalysisOverride(*args, **kwargs): # Test that the codesigning works even if we collect a package as .pyc files, which we do not relocate. @pytest.mark.darwin @importorskip('psutil') -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_signing_pyc_files(pyi_builder, monkeypatch): monkeypatch.setenv("PYINSTALLER_STRICT_BUNDLE_CODESIGN_ERROR", "1") monkeypatch.setenv("PYINSTALLER_VERIFY_BUNDLE_SIGNATURE", "1") @@ -148,7 +148,7 @@ def _create_test_framework(bundle_path): # Test that top-level data file is relocated into `Contents/Resources` and symlinked back into `Contents/Frameworks`. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_data_file(pyi_builder, monkeypatch, tmp_path): datas = [] @@ -172,7 +172,7 @@ def test_macos_bundle_layout_data_file(pyi_builder, monkeypatch, tmp_path): # Test that top-level binary is kept in `Contents/Frameworks` and symlinked into `Contents/Resources`. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_binary(pyi_builder, monkeypatch, tmp_path): binaries = [] @@ -196,7 +196,7 @@ def test_macos_bundle_layout_binary(pyi_builder, monkeypatch, tmp_path): # Test that data-only directory is relocated into `Contents/Resources` and symlinked back into `Contents/Frameworks`. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_data_only_dir(pyi_builder, monkeypatch, tmp_path): datas = [] @@ -247,7 +247,7 @@ def test_macos_bundle_layout_data_only_dir(pyi_builder, monkeypatch, tmp_path): # Test that binary-only directory is kept in `Contents/Frameworks` and symlinked into `Contents/Resources`. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_binary_only_dir(pyi_builder, monkeypatch, tmp_path): binaries = [] @@ -299,7 +299,7 @@ def test_macos_bundle_layout_binary_only_dir(pyi_builder, monkeypatch, tmp_path) # Test that mxied-content directory is created in both `Contents/Frameworks` and `Contents/Resources`, and that files # are put into the proper directory and cross-linked into the other directory. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_mixed_dir(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -353,7 +353,7 @@ def test_macos_bundle_layout_mixed_dir(pyi_builder, monkeypatch, tmp_path): # Repeat the test with mixed-content directory, except that it now contains three sub-directories: a data-only one, # a binary-only one, and mixed-content one. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_mixed_dir_with_subdirs(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -474,7 +474,7 @@ def test_macos_bundle_layout_mixed_dir_with_subdirs(pyi_builder, monkeypatch, tm # Repeat the test with mixed-content directory and sub-directories, except that all directories now contain a dot in # their names. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_mixed_dir_with_subdirs_and_dots(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -632,7 +632,7 @@ def test_macos_bundle_layout_mixed_dir_with_subdirs_and_dots(pyi_builder, monkey # Test with symlink in top-level directory pointing to a data file in data-only directory. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_symlink_into_data_dir(pyi_builder, monkeypatch, tmp_path): datas = [] @@ -686,7 +686,7 @@ def test_macos_bundle_layout_symlink_into_data_dir(pyi_builder, monkeypatch, tmp # Test with symlink in top-level directory pointing to a binary in binary-only directory. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_symlink_into_binary_dir(pyi_builder, monkeypatch, tmp_path): binaries = [] @@ -740,7 +740,7 @@ def test_macos_bundle_layout_symlink_into_binary_dir(pyi_builder, monkeypatch, t # Test with symlinks in top-level directory pointing to files in mixed-content directory. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_symlink_into_mixed_dir(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -829,7 +829,7 @@ def test_macos_bundle_layout_symlink_into_mixed_dir(pyi_builder, monkeypatch, tm # This implicitly also tests that we do not replace the dot in the .framework bundle's directory name (the .framework # bundle directories are the only directories in `Contents/Frameworks` that are allowed to have a dot in name). @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_framework_in_top_level(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -940,7 +940,7 @@ def test_macos_bundle_layout_framework_in_top_level(pyi_builder, monkeypatch, tm # Test with .framework bundle in binary-only directory and framework's binary symlinked to top-level directory. @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_framework_in_binary_dir(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] @@ -1079,7 +1079,7 @@ def test_macos_bundle_layout_framework_in_binary_dir(pyi_builder, monkeypatch, t # This also tests that a directory is recognized as a mixed-content one if it contains a data file and a .framework # bundle (i.e., no other binary files). @pytest.mark.darwin -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_macos_bundle_layout_framework_in_mixed_dir(pyi_builder, monkeypatch, tmp_path): datas = [] binaries = [] diff --git a/tests/functional/test_misc.py b/tests/functional/test_misc.py index 51162496b66..b7112c52b9f 100644 --- a/tests/functional/test_misc.py +++ b/tests/functional/test_misc.py @@ -17,6 +17,7 @@ import pytest from PyInstaller import compat +from PyInstaller.utils.tests import onefile_only # Directory with testing modules used in some tests. _MODULES_DIR = pathlib.Path(__file__).parent / 'modules' @@ -178,10 +179,8 @@ def test_disable_hash_randomization(pyi_builder): # Test that onefile cleanup does not remove contents of a directory that user symlinks into sys._MEIPASS (see #6074). +@onefile_only def test_onefile_cleanup_symlinked_dir(pyi_builder, tmp_path): - if pyi_builder._mode != 'onefile': - pytest.skip('The test is relevant only to onefile builds.') - # Create output directory with five pre-existing files output_dir = tmp_path / 'output_dir' output_dir.mkdir() diff --git a/tests/functional/test_pkgutil.py b/tests/functional/test_pkgutil.py index 93163e1e0df..66d8483557e 100644 --- a/tests/functional/test_pkgutil.py +++ b/tests/functional/test_pkgutil.py @@ -27,7 +27,7 @@ import pytest from PyInstaller.compat import exec_python_rc -from PyInstaller.utils.tests import importable +from PyInstaller.utils.tests import importable, onedir_only, onefile_only # Directory with testing modules used in some tests. _MODULES_DIR = pathlib.Path(__file__).parent / 'modules' @@ -98,9 +98,8 @@ def test_pkgutil_iter_modules(package, script_dir, tmp_path, pyi_builder, archiv # ensure proper matching. # The test is applicable only to macOS in onefile mode. @pytest.mark.darwin +@onefile_only def test_pkgutil_iter_modules_resolve_pkg_path(script_dir, tmp_path, pyi_builder): - if pyi_builder._mode != 'onefile': - pytest.skip('The test is applicable only to onefile mode.') # A single combination (altgraph package, archive mode) is enough to check for proper symlink handling. test_pkgutil_iter_modules('json', script_dir, tmp_path, pyi_builder, archive=True, resolve_pkg_path=True) @@ -118,10 +117,8 @@ def test_pkgutil_iter_modules_resolve_pkg_path(script_dir, tmp_path, pyi_builder # data and binary files, the directory is created in both Contents/Frameworks and Contents/Resources, and the contents # are cross-linked between them on file level. @pytest.mark.darwin +@onedir_only def test_pkgutil_iter_modules_macos_app_bundle(script_dir, tmp_path, pyi_builder, monkeypatch): - if pyi_builder._mode != 'onedir': - pytest.skip('The test is applicable only to onedir mode.') - pathex = _MODULES_DIR / 'pyi_pkgutil_itermodules' / 'package' hooks_dir = _MODULES_DIR / 'pyi_pkgutil_itermodules' / 'hooks' package = 'mypackage' @@ -181,10 +178,8 @@ def test_pkgutil_iter_modules_macos_app_bundle(script_dir, tmp_path, pyi_builder # # This is more explicit version of test_pkgutil_iter_modules_macos_app_bundle, just in case. @pytest.mark.darwin +@onedir_only def test_pkgutil_iter_modules_macos_app_bundle_alternative_search_path(pyi_builder): - if pyi_builder._mode != 'onedir': - pytest.skip('The test is applicable only to onedir mode.') - pyi_builder.test_source( """ import os diff --git a/tests/functional/test_pywin32.py b/tests/functional/test_pywin32.py index f5f2682d21e..f25b5cbce05 100644 --- a/tests/functional/test_pywin32.py +++ b/tests/functional/test_pywin32.py @@ -11,7 +11,7 @@ import pytest -from PyInstaller.utils.tests import importorskip +from PyInstaller.utils.tests import importorskip, onedir_only from PyInstaller.utils.hooks import can_import_module @@ -106,7 +106,7 @@ 'pythoncom', ) ) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) # Run only in onedir mode. +@onedir_only def test_pywin32_imports(pyi_builder, module): if not can_import_module(module): pytest.skip(f"Module '{module}' cannot be imported.") diff --git a/tests/functional/test_qt.py b/tests/functional/test_qt.py index 46a8e3e6a9c..096440fa568 100644 --- a/tests/functional/test_qt.py +++ b/tests/functional/test_qt.py @@ -17,7 +17,7 @@ from PyInstaller.compat import is_win, is_darwin, is_linux from PyInstaller.utils.hooks import check_requirement, can_import_module from PyInstaller.utils.hooks.qt import get_qt_library_info -from PyInstaller.utils.tests import importorskip, requires, skipif +from PyInstaller.utils.tests import importorskip, requires, skipif, onedir_only def qt_param(qt_flavor, *args, **kwargs): @@ -671,27 +671,27 @@ def _test_qt_bindings_import(bindings, module, pyi_builder_onedir): @importorskip('PySide2') @pytest.mark.parametrize('module', _list_all_qt_submodules('PySide2')) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +@onedir_only def test_qt_module_import_PySide2(module, pyi_builder): _test_qt_bindings_import("PySide2", module, pyi_builder) @importorskip('PySide6') @pytest.mark.parametrize('module', _list_all_qt_submodules('PySide6')) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +@onedir_only def test_qt_module_import_PySide6(module, pyi_builder): _test_qt_bindings_import("PySide6", module, pyi_builder) @importorskip('PyQt5') @pytest.mark.parametrize('module', _list_all_qt_submodules('PyQt5')) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +@onedir_only def test_qt_module_import_PyQt5(module, pyi_builder): _test_qt_bindings_import("PyQt5", module, pyi_builder) @importorskip('PyQt6') @pytest.mark.parametrize('module', _list_all_qt_submodules('PyQt6')) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +@onedir_only def test_qt_module_import_PyQt6(module, pyi_builder): _test_qt_bindings_import("PyQt6", module, pyi_builder) diff --git a/tests/functional/test_scipy.py b/tests/functional/test_scipy.py index 74c20dba347..8c1d0a92c59 100644 --- a/tests/functional/test_scipy.py +++ b/tests/functional/test_scipy.py @@ -16,7 +16,7 @@ import pytest -from PyInstaller.utils.tests import importorskip, xfail +from PyInstaller.utils.tests import importorskip, xfail, onedir_only pytestmark = [ importorskip('scipy'), @@ -52,7 +52,7 @@ 'scipy.stats', ] ) -@pytest.mark.parametrize('pyi_builder', ['onedir'], indirect=True) +@onedir_only def test_scipy(pyi_builder, module): pyi_builder.test_source(f""" import {module} diff --git a/tests/functional/test_signals.py b/tests/functional/test_signals.py index 7dc8780f981..4f3ebed1a2f 100644 --- a/tests/functional/test_signals.py +++ b/tests/functional/test_signals.py @@ -15,11 +15,13 @@ import pytest +from PyInstaller.utils.tests import onefile_only + @pytest.mark.darwin @pytest.mark.linux @pytest.mark.parametrize('forward_signals', [True, False], ids=['forward', 'ignore']) -@pytest.mark.parametrize('pyi_builder', ['onefile'], indirect=True) # Run only in onefile mode. +@onefile_only def test_onefile_signal_handling(pyi_builder, forward_signals): # Build the test program. The `pyi_builder.test_soruce` also runs the built program, but since no arguments are # passed via command-line, this program run is a no-op.