Title: agent: when writing skipif for tests that pin a Python version inside uv_init_dir, check both uv availability AND current Python version · Issue #1872 · usethis-python/usethis-python · GitHub
Open Graph Title: agent: when writing skipif for tests that pin a Python version inside uv_init_dir, check both uv availability AND current Python version · Issue #1872 · usethis-python/usethis-python
X Title: agent: when writing skipif for tests that pin a Python version inside uv_init_dir, check both uv availability AND current Python version · Issue #1872 · usethis-python/usethis-python
Description: What happened A test that calls uv python pin 3.13 inside a uv_init_dir-based fixture was guarded with only not is_uv_python_available("3.13"). On the Python 3.14 macOS CI runner, Python 3.13 was installed in uv so the skip did not fire ...
Open Graph Description: What happened A test that calls uv python pin 3.13 inside a uv_init_dir-based fixture was guarded with only not is_uv_python_available("3.13"). On the Python 3.14 macOS CI runner, Python 3.13 was i...
X Description: What happened A test that calls uv python pin 3.13 inside a uv_init_dir-based fixture was guarded with only not is_uv_python_available("3.13"). On the Python 3.14 macOS CI runner, Python ...
Opengraph URL: https://github.com/usethis-python/usethis-python/issues/1872
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"agent: when writing skipif for tests that pin a Python version inside uv_init_dir, check both uv availability AND current Python version","articleBody":"## What happened\n\nA test that calls `uv python pin 3.13` inside a `uv_init_dir`-based fixture was guarded with only `not is_uv_python_available(\"3.13\")`. On the Python 3.14 macOS CI runner, Python 3.13 was installed in uv so the skip did not fire — but the test still failed because the fixture created a project with `requires-python = \"\u003e=3.14\"`, which blocks `uv python pin 3.13`.\n\n## Root cause\n\nPinning a specific Python version X inside a `uv_init_dir` project has two independent failure modes:\n1. Python X is not installed in uv (caught by `is_uv_python_available(X)`).\n2. The current Python is newer than X — the fixture creates a project with `requires-python = \"\u003e=\u003ccurrent\u003e\"`, so `uv python pin X` is rejected by uv.\n\nThe skip condition only covered failure mode 1. Failure mode 2 was introduced silently by an earlier fix that changed the fixture to use the current Python version.\n\n## Generalised principle\n\nWhen writing a `skipif` for a test that pins a specific Python version X inside a `uv_init_dir`-based fixture, the condition must cover both failure modes:\n\n```python\n@pytest.mark.skipif(\n not is_uv_python_available(\"X.Y\") or sys.version_info \u003e (X, Y),\n reason=\"Requires Python X.Y in uv and current Python \u003c= X.Y (otherwise requires-python blocks the pin)\",\n)\n```\n\nThe test can only run when: (a) version X is installed in uv AND (b) the current Python is ≤ X.\n\n## Resolution\n\nAdded `or sys.version_info \u003e (3, 13)` to the `skipif` condition on `test_file_doesnt_exist` in `test_sonarqube_config.py` and added `import sys` to that file.\n\n## Follow-up\n\nConsider whether other tests using `uv_python_pin` inside `uv_init_dir` have the same incomplete skip condition.","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2026-04-07T18:59:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1872/usethis-python/issues/1872"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c1698b15-f751-4810-8a66-fa0f25950414 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB28:2D209F:D7060:139C45:6A4DFA97 |
| html-safe-nonce | c673d6acab5796a708cd956923d79a594ee1cdafd43869068171d5d70a48deec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjI4OjJEMjA5RjpENzA2MDoxMzlDNDU6NkE0REZBOTciLCJ2aXNpdG9yX2lkIjoiNjIwOTIwMDI2NTU5OTI1MzE0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d8aa6b7cff630be51cafa2303179242fd06d779e35870ee2030b8f9c0573fa4 |
| hovercard-subject-tag | issue:4219940982 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/usethis-python/usethis-python/1872/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7f964bd9e63ef944856f8b46f1bc5b6319ce3f53fabbbd84daa31cff6e14ba84/usethis-python/usethis-python/issues/1872 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7f964bd9e63ef944856f8b46f1bc5b6319ce3f53fabbbd84daa31cff6e14ba84/usethis-python/usethis-python/issues/1872 |
| og:image:alt | What happened A test that calls uv python pin 3.13 inside a uv_init_dir-based fixture was guarded with only not is_uv_python_available("3.13"). On the Python 3.14 macOS CI runner, Python 3.13 was i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nathanjmcdougall |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4314b1df11fa8a565684f3a72dc971e3785da365 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width