Rename main_util_fixtures.py to conftest.py to allow fixture auto discovery
Also fix new PEP-008 issues.
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from cibuildwheel import linux, macos, windows, util
|
||||
import pytest
|
||||
|
||||
from cibuildwheel import (
|
||||
linux,
|
||||
macos,
|
||||
util,
|
||||
windows,
|
||||
)
|
||||
|
||||
|
||||
class ArgsInterceptor:
|
||||
@@ -15,6 +20,7 @@ class ArgsInterceptor:
|
||||
|
||||
MOCK_PROJECT_DIR = 'some_project_dir'
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_protection(monkeypatch):
|
||||
'''
|
||||
@@ -31,13 +37,14 @@ def mock_protection(monkeypatch):
|
||||
monkeypatch.setattr(linux, 'build', fail_on_call)
|
||||
monkeypatch.setattr(macos, 'build', fail_on_call)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fake_project_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'):
|
||||
return True
|
||||
@@ -1,14 +1,11 @@
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from cibuildwheel.__main__ import main
|
||||
from cibuildwheel.environment import ParsedEnvironment
|
||||
from cibuildwheel.util import BuildSelector
|
||||
|
||||
from main_util_fixtures import mock_protection, fake_project_dir, platform, intercepted_build_args
|
||||
|
||||
|
||||
|
||||
# CIBW_PLATFORM is tested in main_platform_test.py
|
||||
|
||||
@@ -93,6 +90,7 @@ def get_default_repair_command(platform):
|
||||
else:
|
||||
raise ValueError('Unknown platform', platform)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('repair_command', [None, 'repair', 'repair -w {dest_dir} {wheel}'])
|
||||
@pytest.mark.parametrize('platform_specific', [False, True])
|
||||
def test_repair_command(repair_command, platform_specific, platform, intercepted_build_args, monkeypatch):
|
||||
@@ -225,5 +223,3 @@ def test_build_selector_migrations(intercepted_build_args, monkeypatch, option_n
|
||||
assert intercepted_build_selector.build_patterns == build_selector_patterns
|
||||
else:
|
||||
assert intercepted_build_selector.skip_patterns == build_selector_patterns
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from cibuildwheel.__main__ import main
|
||||
|
||||
from main_util_fixtures import MOCK_PROJECT_DIR, mock_protection, fake_project_dir, platform, intercepted_build_args
|
||||
from conftest import MOCK_PROJECT_DIR # noqa: I100
|
||||
|
||||
|
||||
def test_unknown_platform_non_ci(monkeypatch, capsys):
|
||||
Reference in New Issue
Block a user