Merge remote-tracking branch 'origin/master' into deterministic-builds
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
|
||||
from cibuildwheel.environment import parse_environment
|
||||
|
||||
|
||||
@@ -13,6 +14,7 @@ def test_basic_parsing():
|
||||
assert environment_dict == {'VAR': '1', 'VBR': '2'}
|
||||
assert environment_cmds == ['export VAR=1', 'export VBR=2']
|
||||
|
||||
|
||||
def test_quotes():
|
||||
environment_recipe = parse_environment('A=1 VAR="1 NOT_A_VAR=2" VBR=\'vbr\'')
|
||||
|
||||
@@ -24,6 +26,7 @@ def test_quotes():
|
||||
assert environment_dict == {'A': '1', 'VAR': '1 NOT_A_VAR=2', 'VBR': 'vbr'}
|
||||
assert environment_cmds == ['export A=1', 'export VAR="1 NOT_A_VAR=2"', 'export VBR=\'vbr\'']
|
||||
|
||||
|
||||
def test_inheritance():
|
||||
environment_recipe = parse_environment('PATH=$PATH:/usr/local/bin')
|
||||
|
||||
@@ -35,6 +38,7 @@ def test_inheritance():
|
||||
assert environment_dict == {'PATH': '/usr/bin:/usr/local/bin'}
|
||||
assert environment_cmds == ['export PATH=$PATH:/usr/local/bin']
|
||||
|
||||
|
||||
def test_shell_eval():
|
||||
environment_recipe = parse_environment('VAR="$(echo "a test" string)"')
|
||||
|
||||
@@ -49,6 +53,7 @@ def test_shell_eval():
|
||||
assert environment_dict['VAR'] == 'a test string'
|
||||
assert environment_cmds == ['export VAR="$(echo "a test" string)"']
|
||||
|
||||
|
||||
def test_shell_eval_and_env():
|
||||
environment_recipe = parse_environment('VAR="$(echo "$PREV_VAR" string)"')
|
||||
|
||||
@@ -60,6 +65,7 @@ def test_shell_eval_and_env():
|
||||
assert environment_dict == {'PREV_VAR': '1 2 3', 'VAR': '1 2 3 string'}
|
||||
assert environment_cmds == ['export VAR="$(echo "$PREV_VAR" string)"']
|
||||
|
||||
|
||||
def test_empty_var():
|
||||
environment_recipe = parse_environment('CFLAGS=')
|
||||
|
||||
@@ -71,6 +77,7 @@ def test_empty_var():
|
||||
assert environment_dict == {'CFLAGS': ''}
|
||||
assert environment_cmds == ['export CFLAGS=']
|
||||
|
||||
|
||||
def test_no_vars():
|
||||
environment_recipe = parse_environment('')
|
||||
|
||||
@@ -80,6 +87,7 @@ def test_no_vars():
|
||||
assert environment_dict == {}
|
||||
assert environment_cmds == []
|
||||
|
||||
|
||||
def test_no_vars_pass_through():
|
||||
environment_recipe = parse_environment('')
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
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(object):
|
||||
class ArgsInterceptor:
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
@@ -15,6 +20,7 @@ class ArgsInterceptor(object):
|
||||
|
||||
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,15 +1,12 @@
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
from fnmatch import fnmatch
|
||||
|
||||
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
|
||||
|
||||
@@ -97,6 +94,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):
|
||||
@@ -229,5 +227,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