1- # ruff: noqa: S602, S607
1+ # ruff: noqa: S607
2+ import shutil
23import subprocess
4+ from pathlib import Path
35
46
57def test ():
68 """Run pytest tests."""
7- subprocess .run ("pytest tests " , shell = True , check = True )
9+ subprocess .run ([ "pytest" , "tests" ] , check = True )
810
911
1012def 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
1517def cov_report ():
1618 """Generate coverage report."""
17- subprocess .run ("coverage xml " , shell = True , check = True )
19+ subprocess .run ([ "coverage" , "xml" ] , check = True )
1820
1921
2022def cov ():
@@ -25,14 +27,17 @@ def cov():
2527
2628def 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
3641def 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