Rename main_util_fixtures.py to conftest.py to allow fixture auto discovery
Also fix new PEP-008 issues.
This commit is contained in:
@@ -12,7 +12,10 @@ from cibuildwheel.environment import (
|
|||||||
EnvironmentParseError,
|
EnvironmentParseError,
|
||||||
parse_environment,
|
parse_environment,
|
||||||
)
|
)
|
||||||
from cibuildwheel.util import BuildSelector, Unbuffered
|
from cibuildwheel.util import (
|
||||||
|
BuildSelector,
|
||||||
|
Unbuffered
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_option_from_environment(option_name, platform=None, default=None):
|
def get_option_from_environment(option_name, platform=None, default=None):
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import bashlex
|
import bashlex
|
||||||
@@ -67,6 +66,5 @@ def evaluate_command_node(node, context):
|
|||||||
return subprocess.check_output(shlex.split(command), env=context.environment, universal_newlines=True)
|
return subprocess.check_output(shlex.split(command), env=context.environment, universal_newlines=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def evaluate_parameter_node(node, context):
|
def evaluate_parameter_node(node, context):
|
||||||
return context.environment.get(node.value, '')
|
return context.environment.get(node.value, '')
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class ImportMarkdownPlugin(mkdocs.plugins.BasePlugin):
|
|||||||
|
|
||||||
return text_to_include
|
return text_to_include
|
||||||
|
|
||||||
|
|
||||||
def found_includemarkdown_tag(match):
|
def found_includemarkdown_tag(match):
|
||||||
filename = match.group('filename')
|
filename = match.group('filename')
|
||||||
start = match.group('start')
|
start = match.group('start')
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
|
||||||
project_dir = os.path.dirname(__file__)
|
project_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
|
||||||
def test_cpp11(tmp_path):
|
def test_cpp11(tmp_path):
|
||||||
# This test checks that the C++11 standard is supported
|
# This test checks that the C++11 standard is supported
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import os, sys
|
import os
|
||||||
from setuptools import setup, Extension
|
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
from setuptools import (
|
||||||
|
Extension,
|
||||||
|
setup,
|
||||||
|
)
|
||||||
|
|
||||||
standard = os.environ["STANDARD"]
|
standard = os.environ["STANDARD"]
|
||||||
|
|
||||||
language_standard = "/std:c++" + standard if platform.system() == "Windows" else "-std=c++" + standard
|
language_standard = "/std:c++" + standard if platform.system() == "Windows" else "-std=c++" + standard
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import pytest
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
from cibuildwheel import linux, macos, windows, util
|
import pytest
|
||||||
|
|
||||||
|
from cibuildwheel import (
|
||||||
|
linux,
|
||||||
|
macos,
|
||||||
|
util,
|
||||||
|
windows,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ArgsInterceptor:
|
class ArgsInterceptor:
|
||||||
@@ -15,6 +20,7 @@ class ArgsInterceptor:
|
|||||||
|
|
||||||
MOCK_PROJECT_DIR = 'some_project_dir'
|
MOCK_PROJECT_DIR = 'some_project_dir'
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_protection(monkeypatch):
|
def mock_protection(monkeypatch):
|
||||||
'''
|
'''
|
||||||
@@ -31,13 +37,14 @@ def mock_protection(monkeypatch):
|
|||||||
monkeypatch.setattr(linux, 'build', fail_on_call)
|
monkeypatch.setattr(linux, 'build', fail_on_call)
|
||||||
monkeypatch.setattr(macos, 'build', fail_on_call)
|
monkeypatch.setattr(macos, 'build', fail_on_call)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def fake_project_dir(monkeypatch):
|
def fake_project_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_PROJECT_DIR, 'setup.py'):
|
||||||
return True
|
return True
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
import pytest
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from cibuildwheel.__main__ import main
|
from cibuildwheel.__main__ import main
|
||||||
from cibuildwheel.environment import ParsedEnvironment
|
from cibuildwheel.environment import ParsedEnvironment
|
||||||
from cibuildwheel.util import BuildSelector
|
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
|
# CIBW_PLATFORM is tested in main_platform_test.py
|
||||||
|
|
||||||
@@ -93,6 +90,7 @@ def get_default_repair_command(platform):
|
|||||||
else:
|
else:
|
||||||
raise ValueError('Unknown platform', platform)
|
raise ValueError('Unknown platform', platform)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('repair_command', [None, 'repair', 'repair -w {dest_dir} {wheel}'])
|
@pytest.mark.parametrize('repair_command', [None, 'repair', 'repair -w {dest_dir} {wheel}'])
|
||||||
@pytest.mark.parametrize('platform_specific', [False, True])
|
@pytest.mark.parametrize('platform_specific', [False, True])
|
||||||
def test_repair_command(repair_command, platform_specific, platform, intercepted_build_args, monkeypatch):
|
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
|
assert intercepted_build_selector.build_patterns == build_selector_patterns
|
||||||
else:
|
else:
|
||||||
assert intercepted_build_selector.skip_patterns == build_selector_patterns
|
assert intercepted_build_selector.skip_patterns == build_selector_patterns
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import pytest
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from cibuildwheel.__main__ import main
|
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):
|
def test_unknown_platform_non_ci(monkeypatch, capsys):
|
||||||
Reference in New Issue
Block a user