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,
|
||||
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):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
||||
def evaluate_parameter_node(node, context):
|
||||
return context.environment.get(node.value, '')
|
||||
|
||||
@@ -55,7 +55,6 @@ class ImportMarkdownPlugin(mkdocs.plugins.BasePlugin):
|
||||
|
||||
return text_to_include
|
||||
|
||||
|
||||
def found_includemarkdown_tag(match):
|
||||
filename = match.group('filename')
|
||||
start = match.group('start')
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
import utils
|
||||
|
||||
|
||||
project_dir = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def test_cpp11(tmp_path):
|
||||
# This test checks that the C++11 standard is supported
|
||||
|
||||
@@ -18,8 +17,8 @@ def test_cpp11(tmp_path):
|
||||
|
||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||
expected_wheels = [x for x in utils.expected_wheels(
|
||||
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||
if 'cp27-cp27m-win' not in x]
|
||||
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||
if 'cp27-cp27m-win' not in x]
|
||||
assert set(actual_wheels) == set(expected_wheels)
|
||||
|
||||
|
||||
@@ -35,15 +34,15 @@ def test_cpp14():
|
||||
|
||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||
expected_wheels = [x for x in utils.expected_wheels(
|
||||
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||
assert set(actual_wheels) == set(expected_wheels)
|
||||
|
||||
|
||||
def test_cpp17():
|
||||
# This test checks that the C++17 standard is supported
|
||||
|
||||
# Python 2.7 uses the `register` keyword which is forbidden in the C++17 standard
|
||||
# Python 2.7 uses the `register` keyword which is forbidden in the C++17 standard
|
||||
# The manylinux1 docker image does not have a compiler which supports C++11
|
||||
# Python 3.4 and 3.5 are compiled with MSVC 10, which does not support C++17
|
||||
if os.environ.get('APPVEYOR_BUILD_WORKER_IMAGE', '') == 'Visual Studio 2015':
|
||||
@@ -55,6 +54,6 @@ def test_cpp17():
|
||||
|
||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||
expected_wheels = [x for x in utils.expected_wheels(
|
||||
'spam', '0.1.0', macosx_deployment_target='10.13')
|
||||
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||
'spam', '0.1.0', macosx_deployment_target='10.13')
|
||||
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||
assert set(actual_wheels) == set(expected_wheels)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import os, sys
|
||||
from setuptools import setup, Extension
|
||||
import os
|
||||
import platform
|
||||
|
||||
from setuptools import (
|
||||
Extension,
|
||||
setup,
|
||||
)
|
||||
|
||||
standard = os.environ["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 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