From ed50cfd20a64f55302745ad725ad4e7be551b8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0?= Date: Sat, 28 Mar 2020 16:25:57 +0100 Subject: [PATCH] Fix tests --- unit_test/main_tests/conftest.py | 8 ++++---- unit_test/main_tests/main_platform_test.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/unit_test/main_tests/conftest.py b/unit_test/main_tests/conftest.py index 227b8df7..cd896915 100644 --- a/unit_test/main_tests/conftest.py +++ b/unit_test/main_tests/conftest.py @@ -18,7 +18,7 @@ class ArgsInterceptor: self.kwargs = kwargs -MOCK_PROJECT_DIR = 'some_project_dir' +MOCK_PACKAGE_DIR = 'some_package_dir' @pytest.fixture(autouse=True) @@ -39,20 +39,20 @@ def mock_protection(monkeypatch): @pytest.fixture(autouse=True) -def fake_project_dir(monkeypatch): +def fake_package_dir(monkeypatch): ''' Monkey-patch enough for the main() function to run ''' real_os_path_exists = os.path.exists def mock_os_path_exists(path): - if path == os.path.join(MOCK_PROJECT_DIR, 'setup.py'): + if path == os.path.join(MOCK_PACKAGE_DIR, 'setup.py'): return True else: return real_os_path_exists(path) monkeypatch.setattr(os.path, 'exists', mock_os_path_exists) - monkeypatch.setattr(sys, 'argv', ['cibuildwheel', MOCK_PROJECT_DIR]) + monkeypatch.setattr(sys, 'argv', ['cibuildwheel', MOCK_PACKAGE_DIR]) @pytest.fixture(params=['linux', 'macos', 'windows']) diff --git a/unit_test/main_tests/main_platform_test.py b/unit_test/main_tests/main_platform_test.py index 5b33a4d5..18d10e13 100644 --- a/unit_test/main_tests/main_platform_test.py +++ b/unit_test/main_tests/main_platform_test.py @@ -4,7 +4,7 @@ import pytest from cibuildwheel.__main__ import main -from conftest import MOCK_PROJECT_DIR # noqa: I100 +from conftest import MOCK_PACKAGE_DIR # noqa: I100 def test_unknown_platform_non_ci(monkeypatch, capsys): @@ -51,10 +51,10 @@ def test_platform_argument(platform, intercepted_build_args, monkeypatch): main() - assert intercepted_build_args.kwargs['project_dir'] == MOCK_PROJECT_DIR + assert intercepted_build_args.kwargs['package_dir'] == MOCK_PACKAGE_DIR def test_platform_environment(platform, intercepted_build_args, monkeypatch): main() - assert intercepted_build_args.kwargs['project_dir'] == MOCK_PROJECT_DIR + assert intercepted_build_args.kwargs['package_dir'] == MOCK_PACKAGE_DIR