Skip to content

Commit bc70635

Browse files
In tests which sentinel for version bumps, use requires-python rather than .python-version
This is since the latter can now change dynamically in CI. We need something for determining usethis's minimum supported Python verion.
1 parent 68e9fd0 commit bc70635

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

tests/usethis/_integrations/ci/bitbucket/test_bitbucket_schema.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import requests
66

77
from usethis._integrations.ci.bitbucket.schema import Script, Step, Step2, StepBase
8+
from usethis._integrations.file.pyproject_toml.io_ import PyprojectTOMLManager
9+
from usethis._integrations.file.pyproject_toml.requires_python import (
10+
get_requires_python,
11+
)
812
from usethis._test import is_offline
913

1014

@@ -40,4 +44,5 @@ def test_matches_schema_store(self):
4044

4145
def test_target_python_version(self):
4246
# If this test fails, we should bump the version in the command in schema.py
43-
assert Path(".python-version").read_text().startswith("3.10")
47+
with PyprojectTOMLManager():
48+
assert get_requires_python() == ">=3.10"

tests/usethis/_integrations/pre_commit/test_pre_commit_schema.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import pytest
55
import requests
66

7+
from usethis._integrations.file.pyproject_toml.io_ import PyprojectTOMLManager
8+
from usethis._integrations.file.pyproject_toml.requires_python import (
9+
get_requires_python,
10+
)
711
from usethis._integrations.pre_commit.schema import HookDefinition, LocalRepo
812
from usethis._test import is_offline
913

@@ -42,4 +46,5 @@ def test_matches_schema_store(self):
4246

4347
def test_target_python_version(self):
4448
# If this test fails, we should bump the version in the command in schema.py
45-
assert Path(".python-version").read_text().startswith("3.10")
49+
with PyprojectTOMLManager():
50+
assert get_requires_python() == ">=3.10"

0 commit comments

Comments
 (0)