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,21 @@ 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+
35+ for file in source_dir .glob ("*" ):
36+ if file .is_file ():
37+ shutil .copy (file , dest_dir )
38+
39+ subprocess .run (["behave" , "tests/features/" ], check = True )
40+
41+ for feature_file in dest_dir .glob ("*.feature" ):
42+ feature_file .unlink ()
3443
3544
3645def precommit ():
3746 """Run pre-commit hooks."""
38- subprocess .run ("uv run pre-commit run --all-files" , shell = True , check = True )
47+ subprocess .run ([ "uv" , " run" , " pre-commit" , " run" , " --all-files"] , check = True )
0 commit comments