Add python-patch feature to isolate tests that require Python patch versions to match our suite (#2940)

Closes https://github.com/astral-sh/uv/issues/2165
Follows https://github.com/astral-sh/uv/pull/2930
This commit is contained in:
Zanie Blue 2024-04-10 09:01:25 -05:00 committed by GitHub
parent 273de456ea
commit c345a79b9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 22 additions and 3 deletions

View file

@ -133,6 +133,13 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
else []
)
# Hack to track which scenarios require a specific Python patch version
for scenario in data["scenarios"]:
if "patch" in scenario["name"]:
scenario["python_patch"] = True
else:
scenario["python_patch"] = False
# We don't yet support local versions that aren't expressed as direct dependencies.
for scenario in data["scenarios"]:
expected = scenario["expected"]

View file

@ -58,6 +58,9 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
/// {{.}}
{{/tree}}
/// ```
{{#python_patch}}
#[cfg(feature = "python-patch")]
{{/python_patch}}
#[test]
fn {{module_name}}() -> Result<()> {
let context = TestContext::new("{{environment.python}}");

View file

@ -77,6 +77,9 @@ fn command(context: &TestContext) -> Command {
/// {{.}}
{{/tree}}
/// ```
{{#python_patch}}
#[cfg(feature = "python-patch")]
{{/python_patch}}
#[test]
fn {{module_name}}() {
let context = TestContext::new("{{environment.python}}");