Skip to content

Commit 20cc981

Browse files
committed
remove shell flag usage in project scripts
Signed-off-by: gruebel <[email protected]>
1 parent de37144 commit 20cc981

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

scripts/scripts.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
# ruff: noqa: S602, S607
1+
# ruff: noqa: S607
2+
import shutil
23
import subprocess
4+
from pathlib import Path
35

46

57
def test():
68
"""Run pytest tests."""
7-
subprocess.run("pytest tests", shell=True, check=True)
9+
subprocess.run(["pytest", "tests"], check=True)
810

911

1012
def test_cov():
1113
"""Run tests with coverage."""
12-
subprocess.run("coverage run -m pytest tests", shell=True, check=True)
14+
subprocess.run(["coverage", "run", "-m", "pytest", "tests"], check=True)
1315

1416

1517
def cov_report():
1618
"""Generate coverage report."""
17-
subprocess.run("coverage xml", shell=True, check=True)
19+
subprocess.run(["coverage", "xml"], check=True)
1820

1921

2022
def cov():
@@ -25,14 +27,17 @@ def cov():
2527

2628
def e2e():
2729
"""Run end-to-end tests."""
28-
subprocess.run("git submodule update --init --recursive", shell=True, check=True)
29-
subprocess.run(
30-
"cp spec/specification/assets/gherkin/* tests/features/", shell=True, check=True
31-
)
32-
subprocess.run("behave tests/features/", shell=True, check=True)
33-
subprocess.run("rm tests/features/*.feature", shell=True, check=True)
30+
source_dir = Path("spec/specification/assets/gherkin")
31+
dest_dir = Path("tests/features")
32+
33+
subprocess.run(["git", "submodule", "update", "--init", "--recursive"], check=True)
34+
shutil.copytree(source_dir, dest_dir, dirs_exist_ok=True)
35+
subprocess.run(["behave", "tests/features/"], check=True)
36+
37+
for feature_file in dest_dir.glob("*.feature"):
38+
feature_file.unlink()
3439

3540

3641
def precommit():
3742
"""Run pre-commit hooks."""
38-
subprocess.run("uv run pre-commit run --all-files", shell=True, check=True)
43+
subprocess.run(["uv", "run", "pre-commit", "run", "--all-files"], check=True)

0 commit comments

Comments
 (0)