Skip to content

Commit

Permalink
fix(types): make the passthrough general
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored and layday committed Feb 26, 2024
1 parent af5ff53 commit aa0aa04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/build/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _minimum_pip_version() -> str:
return '19.1.0'


def _has_valid_pip(**distargs: str) -> bool:
def _has_valid_pip(**distargs: object) -> bool:
"""
Given a path, see if Pip is present and return True if the version is
sufficient for build, False if it is not.
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def is_integration(item):
return os.path.basename(item.location[0]) == 'test_integration.py'


@pytest.fixture()
def local_pip(monkeypatch):
monkeypatch.setattr(build.env, '_valid_global_pip', lambda: None)


@pytest.fixture(scope='session', autouse=True)
def ensure_syconfig_vars_created():
# the config vars are globally cached and may use get_path, make sure they are created
Expand Down
3 changes: 3 additions & 0 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_isolation():


@pytest.mark.isolated
@pytest.mark.usefixtures('local_pip')
def test_isolated_environment_install(mocker):
with build.env.DefaultIsolatedEnv() as env:
mocker.patch('build.env._subprocess')
Expand Down Expand Up @@ -117,6 +118,7 @@ def test_isolated_env_log(mocker, caplog, package_test_flit):


@pytest.mark.isolated
@pytest.mark.usefixtures('local_pip')
def test_default_pip_is_never_too_old():
with build.env.DefaultIsolatedEnv() as env:
version = subprocess.check_output(
Expand All @@ -130,6 +132,7 @@ def test_default_pip_is_never_too_old():
@pytest.mark.isolated
@pytest.mark.parametrize('pip_version', ['20.2.0', '20.3.0', '21.0.0', '21.0.1'])
@pytest.mark.parametrize('arch', ['x86_64', 'arm64'])
@pytest.mark.usefixtures('local_pip')
def test_pip_needs_upgrade_mac_os_11(mocker, pip_version, arch):
SimpleNamespace = collections.namedtuple('SimpleNamespace', 'version')

Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def main_reload_styles():
],
ids=['no-color', 'color'],
)
@pytest.mark.usefixtures('local_pip')
def test_output_env_subprocess_error(
mocker,
monkeypatch,
Expand Down

0 comments on commit aa0aa04

Please sign in to comment.