-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat:add tests with uv #13825
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
base: main
Are you sure you want to change the base?
feat:add tests with uv #13825
Conversation
Acceptance test needed to be adjusted as test_stop_iteration_runtest_protocol triggers a different error message that seems to map to PEP-0479 when using a uv provided python environment.
Coverage is already done in the standard tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this @sgaist! Please see my comments/questions.
| dependencies = [ | ||
| "colorama>=0.4; sys_platform=='win32'", | ||
| "exceptiongroup>=1; python_version<'3.11'", | ||
| "iniconfig>=1.0.1", | ||
| "exceptiongroup>=1.1; python_version<'3.11'", | ||
| "iniconfig>=2", | ||
| "packaging>=22", | ||
| "pluggy>=1.5,<2", | ||
| "pygments>=2.7.2", | ||
| "pygments>=2.14", | ||
| "tomli>=1; python_version<'3.11'", | ||
| ] | ||
| optional-dependencies.dev = [ | ||
| "argcomplete", | ||
| "attrs>=19.2", | ||
| "hypothesis>=3.56", | ||
| "mock", | ||
| "requests", | ||
| "setuptools", | ||
| "xmlschema", | ||
| "argcomplete>=3.5", | ||
| "attrs>=21", | ||
| "hypothesis>=5", | ||
| "mock>=5", | ||
| "requests>=2.26", | ||
| "setuptools>=80", | ||
| "xmlschema>=3", | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these changes needed? Is it from testing with lowest-direct?
For the dev deps I don't mind much, perhaps except for attrs and mock which we use for testing pytest integration features so being able to test with older versions is somewhat useful.
But for the runtime dependencies, how did you determine the lower bounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, lowest-direct showed that the oldest version it could get were sometimes using obsolete APIs.
My first tries were to slowly bump the versions of the dependencies that were posing problems. Since some of them were a bit less cooperative, I went to check which years the packages had releases around Python 3.10 initial release. So, in the absolute, I would say it's worth revisiting them to ensure I did not miss something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your method sounds good to me (cc @RonnyPfannschmidt on iniconfig).
Could you add a packaging changelog entry detailing the changes to the lower bounds of exceptiongroup, iniconfig and pygments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done but I may have been a bit short
.github/workflows/test-uv.yml
Outdated
| @@ -0,0 +1,125 @@ | |||
| name: test uv | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would all-around be better if we could integrate this into the main workflow file, just controlling it with a matrix option (environment variables).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I got it correctly in the main test workflow.
|
@sgaist Thanks for the update. To clarify, I'd like the tox and CI to be in the same file/job. I'm thinking something like this: diff --git i/.github/workflows/test.yml w/.github/workflows/test.yml
index 1c5eb584f..481fdad20 100644
--- i/.github/workflows/test.yml
+++ w/.github/workflows/test.yml
@@ -56,7 +56,7 @@ jobs:
fail-fast: false
matrix:
name: [
- "windows-py310-unittest-asynctest",
+ "windows-py310-unittest-asynctest-lowestdirect-onlymanaged",
"windows-py310-unittest-twisted24",
"windows-py310-unittest-twisted25",
"windows-py310-pluggy",
@@ -90,11 +90,12 @@ jobs:
include:
# Use separate jobs for different unittest flavors (twisted, asynctest) to ensure proper coverage.
- - name: "windows-py310-unittest-asynctest"
+ - name: "windows-py310-unittest-asynctest-lowestdirect-onlymanaged",
python: "3.10"
os: windows-latest
- tox_env: "py310-asynctest"
+ tox_env: "py310-asynctest-lowestdirect-onlymanaged"
use_coverage: true
+ use_uv: true
- name: "windows-py310-unittest-twisted24"
python: "3.10"
@@ -273,6 +274,11 @@ jobs:
python -m pip install --upgrade pip
pip install tox coverage
+ - name: Set up uv
+ if: "matrix.use_uv"
+ shell: bash
+ run: pip install tox-uv
+
- name: Test without coverage
if: "! matrix.use_coverage"
shell: bash
diff --git i/tox.ini w/tox.ini
index fa86c9c44..cf5f7fef0 100644
--- i/tox.ini
+++ w/tox.ini
@@ -39,6 +39,8 @@ description =
twisted25: against the unit test extras with twisted 25.0 or later
asynctest: against the unit test extras with asynctest
xdist: with pytest in parallel mode
+ lowestdirect: using lowest-direct resolution when running with uv
+ onlymanaged: using only managed python running with uv
under `{basepython}`
doctesting: including doctests
commands =
@@ -80,6 +82,10 @@ setenv =
lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof
xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto
+uv_resolution =
+ lowestdirect: lowest-direct
+uv_python_preference =
+ onlymanaged: only-managed
extras = dev
deps =
doctesting: PyYAMLI tried it, unfortunately I hit some problem with tox-uv: tox-dev/tox-uv#260 |
Add a tox configuration that runs tests using uv and its own provided python versions.
This configuration uses the lowest-direct resolution logic as well as only use uv manager python version.
Fixes #13177