Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions scripts/scripts.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# ruff: noqa: S602, S607
# ruff: noqa: S607
import shutil
import subprocess
from pathlib import Path


def test():
"""Run pytest tests."""
subprocess.run("pytest tests", shell=True, check=True)
subprocess.run(["pytest", "tests"], check=True)


def test_cov():
"""Run tests with coverage."""
subprocess.run("coverage run -m pytest tests", shell=True, check=True)
subprocess.run(["coverage", "run", "-m", "pytest", "tests"], check=True)


def cov_report():
"""Generate coverage report."""
subprocess.run("coverage xml", shell=True, check=True)
subprocess.run(["coverage", "xml"], check=True)


def cov():
Expand All @@ -25,14 +27,21 @@ def cov():

def e2e():
"""Run end-to-end tests."""
subprocess.run("git submodule update --init --recursive", shell=True, check=True)
subprocess.run(
"cp spec/specification/assets/gherkin/* tests/features/", shell=True, check=True
)
subprocess.run("behave tests/features/", shell=True, check=True)
subprocess.run("rm tests/features/*.feature", shell=True, check=True)
source_dir = Path("spec/specification/assets/gherkin")
dest_dir = Path("tests/features")

subprocess.run(["git", "submodule", "update", "--init", "--recursive"], check=True)

for file in source_dir.glob("*"):
if file.is_file():
shutil.copy(file, dest_dir)

subprocess.run(["behave", "tests/features/"], check=True)

for feature_file in dest_dir.glob("*.feature"):
feature_file.unlink()


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