Skip to content

Commit 0f97356

Browse files
authored
Use the MDDJ API in test script (rather than CLI) (#1347)
1 parent 909f7f2 commit 0f97356

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ typing-mindeps = [
9090
]
9191
check-project-metadata = [
9292
"ruamel.yaml<0.19",
93-
"mddj==0.1.0",
93+
"mddj==0.4.2",
9494
]
9595

9696
[tool.setuptools.packages.find]

scripts/ensure_min_python_is_tested.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
#
44
# no other usages are supported
55
import pathlib
6-
import subprocess
76
import sys
87

8+
import mddj.api
99
import ruamel.yaml
1010

11+
dj = mddj.api.DJ()
1112
YAML = ruamel.yaml.YAML(typ="safe")
1213
REPO_ROOT = pathlib.Path(__file__).parent.parent
1314

14-
proc = subprocess.run(
15-
["python", "-m", "mddj", "read", "requires-python", "--lower-bound"],
16-
check=True,
17-
capture_output=True,
18-
cwd=REPO_ROOT,
19-
)
20-
requires_python_version = proc.stdout.decode().strip()
15+
requires_python_version = dj.read.requires_python(lower_bound=True)
16+
print("requires-python:", requires_python_version)
2117

2218
with open(REPO_ROOT / ".github" / "workflows" / "test.yaml") as f:
2319
workflow = YAML.load(f)
@@ -35,6 +31,7 @@
3531
raise ValueError("Could not find a '-mindeps' tox-post-environment.")
3632

3733
python_version, _, _ = environment.partition("-")
34+
print("test-mindeps job python:", python_version)
3835
if python_version != f"py{requires_python_version}":
3936
print("ERROR: ensure_min_python_is_tested.py failed!")
4037
print(
@@ -45,13 +42,8 @@
4542
sys.exit(1)
4643

4744

48-
proc = subprocess.run(
49-
["python", "-m", "mddj", "read", "tox", "min-version"],
50-
check=True,
51-
capture_output=True,
52-
cwd=REPO_ROOT,
53-
)
54-
tox_min_python_version = proc.stdout.decode().strip()
45+
tox_min_python_version = dj.read.tox.min_python_version()
46+
print("tox min python version:", tox_min_python_version)
5547
if tox_min_python_version != requires_python_version:
5648
print("ERROR: ensure_min_python_is_tested.py failed!")
5749
print(

0 commit comments

Comments
 (0)