Rewrite bin scripts to python in scripts/ dir
This commit is contained in:
parent
12727c4d1c
commit
0beb2128bd
9 changed files with 53 additions and 32 deletions
17
scripts/run.py
Executable file
17
scripts/run.py
Executable file
|
@ -0,0 +1,17 @@
|
|||
import sys
|
||||
import git
|
||||
import subprocess
|
||||
|
||||
# Pull the release branch
|
||||
repo = git.Repo(search_parent_directories=True)
|
||||
if repo.active_branch.name != "release":
|
||||
print(f"Refusing to run on branch '{repo.active_branch.name}'")
|
||||
sys.exit(1)
|
||||
repo.remotes.origin.pull()
|
||||
|
||||
# Install any new pip requirements
|
||||
subprocess.run([sys.executable, "-m", "pip", "install",
|
||||
"-r", "requirements.txt"], check=True)
|
||||
|
||||
# Run Matchy!
|
||||
subprocess.run([sys.executable, "py/matchy.py"], check=True)
|
9
scripts/test-cov.py
Executable file
9
scripts/test-cov.py
Executable file
|
@ -0,0 +1,9 @@
|
|||
import pytest
|
||||
import sys
|
||||
|
||||
# Run pytest with a coverage report
|
||||
exitcode = pytest.main([
|
||||
"--cov", ".",
|
||||
"--cov-report", "html"
|
||||
])
|
||||
sys.exit(exitcode)
|
15
scripts/test.py
Normal file
15
scripts/test.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pytest
|
||||
import sys
|
||||
from flake8.main.application import Application
|
||||
|
||||
# Run flake
|
||||
app = Application()
|
||||
ret = app.run(["--max-line-length", "120", "py/", "scripts/"])
|
||||
flake_exitcode = app.exit_code()
|
||||
print(flake_exitcode)
|
||||
|
||||
# Run pytest
|
||||
pytest_exitcode = pytest.main()
|
||||
|
||||
# Exit based on the two codes
|
||||
sys.exit(flake_exitcode + pytest_exitcode)
|
Loading…
Add table
Add a link
Reference in a new issue