Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: try using tox-uv #738

Merged
merged 5 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/reusable-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ jobs:
with:
fetch-depth: 0

- name: Setup uv
uses: astral-sh/setup-uv@v4

- name: Install tox (uv)
if: matrix.py != 'pypy3.8'
run: uv tool install tox --with tox-uv

- name: Install tox (pypy 3.8)
if: matrix.py == 'pypy3.8'
run: uv tool install tox

- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v5
with:
Expand All @@ -65,14 +76,6 @@ jobs:
file.write(env)
shell: python

- name: Setup python for tox
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: python -m pip install tox

- name: Run test suite via tox
if: matrix.tox-target == 'tox'
run: |
Expand Down
6 changes: 5 additions & 1 deletion tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def test_can_get_venv_paths_with_conflicting_default_scheme(
assert get_scheme_names.call_count == 1


@pytest.mark.skipif('posix_local' not in sysconfig.get_scheme_names(), reason='workaround for Debian/Ubuntu Python')
SCHEME_NAMES = sysconfig.get_scheme_names()


@pytest.mark.skipif('posix_local' not in SCHEME_NAMES, reason='workaround for Debian/Ubuntu Python')
@pytest.mark.skipif('venv' in SCHEME_NAMES, reason='different call if venv is in scheme names')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't venv always in SCHEME_NAMES, since 3.11?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this test pass, then?

build/src/build/env.py

Lines 346 to 353 in e9adbf0

if 'venv' in scheme_names:
# Python distributors with custom default installation scheme can set a
# scheme that can't be used to expand the paths in a venv.
# This can happen if build itself is not installed in a venv.
# The distributors are encouraged to set a "venv" scheme to be used for this.
# See https://bugs.python.org/issue45413
# and https://github.com/pypa/virtualenv/issues/2208
paths = sysconfig.get_paths(scheme='venv', vars=config_vars)
seems to trigger a path that would fail this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(get_paths.assert_called_once_with(scheme='posix_prefix', vars=mocker.ANY, specifically)

def test_can_get_venv_paths_with_posix_local_default_scheme(
mocker: pytest_mock.MockerFixture,
):
Expand Down
Loading