Fix tests
This commit is contained in:
@@ -18,7 +18,7 @@ class ArgsInterceptor:
|
|||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
|
||||||
MOCK_PROJECT_DIR = 'some_project_dir'
|
MOCK_PACKAGE_DIR = 'some_package_dir'
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
@@ -39,20 +39,20 @@ def mock_protection(monkeypatch):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def fake_project_dir(monkeypatch):
|
def fake_package_dir(monkeypatch):
|
||||||
'''
|
'''
|
||||||
Monkey-patch enough for the main() function to run
|
Monkey-patch enough for the main() function to run
|
||||||
'''
|
'''
|
||||||
real_os_path_exists = os.path.exists
|
real_os_path_exists = os.path.exists
|
||||||
|
|
||||||
def mock_os_path_exists(path):
|
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
|
return True
|
||||||
else:
|
else:
|
||||||
return real_os_path_exists(path)
|
return real_os_path_exists(path)
|
||||||
|
|
||||||
monkeypatch.setattr(os.path, 'exists', mock_os_path_exists)
|
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'])
|
@pytest.fixture(params=['linux', 'macos', 'windows'])
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import pytest
|
|||||||
|
|
||||||
from cibuildwheel.__main__ import main
|
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):
|
def test_unknown_platform_non_ci(monkeypatch, capsys):
|
||||||
@@ -51,10 +51,10 @@ def test_platform_argument(platform, intercepted_build_args, monkeypatch):
|
|||||||
|
|
||||||
main()
|
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):
|
def test_platform_environment(platform, intercepted_build_args, monkeypatch):
|
||||||
main()
|
main()
|
||||||
|
|
||||||
assert intercepted_build_args.kwargs['project_dir'] == MOCK_PROJECT_DIR
|
assert intercepted_build_args.kwargs['package_dir'] == MOCK_PACKAGE_DIR
|
||||||
|
|||||||
Reference in New Issue
Block a user