diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-17 09:41:48 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-17 09:41:48 +0200 |
commit | e785dbd4f726c5716f21071ed25dc35ac87c0c74 (patch) | |
tree | 781373b78380a1ffd1ea8c5dc8ceb2bd313631e9 /dev | |
parent | 4eff4a32cfa594cc2a3df3885de92d407edc6675 (diff) |
Dev tools and directory structure rework.
Diffstat (limited to 'dev')
-rw-r--r-- | dev/README.md | 18 | ||||
-rw-r--r-- | dev/__init__.py | 8 | ||||
-rw-r--r-- | dev/commands.py | 36 |
3 files changed, 62 insertions, 0 deletions
diff --git a/dev/README.md b/dev/README.md new file mode 100644 index 0000000..dd0b2dc --- /dev/null +++ b/dev/README.md @@ -0,0 +1,18 @@ +# Ohjeita kehitykseen +## Riippuvuuksien asennus: +`PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring poetry install` + +## Aja pytest: +`poetry run pytest` + +## Generoi haarakattavuusraportti: +`poetry run covhtml` + +## Avaa haarakattavuusraportti Firefoxilla: +`poetry run covff` + +## Linttaus: +`poetry run pylint` + +## Kaikki +`poetry run all` diff --git a/dev/__init__.py b/dev/__init__.py new file mode 100644 index 0000000..52cc7d9 --- /dev/null +++ b/dev/__init__.py @@ -0,0 +1,8 @@ +from .commands import ( + dev_pylint, + dev_pytest, + dev_coverage, + dev_covhtml, + dev_covxml, + dev_covff, + dev_all) diff --git a/dev/commands.py b/dev/commands.py new file mode 100644 index 0000000..ed9341a --- /dev/null +++ b/dev/commands.py @@ -0,0 +1,36 @@ +import pytest +import pylint +from subprocess import run + +def dev_pylint(): + return pylint.run_pylint(argv=["-v", "src/miinaharava"]) + +def dev_pytest(): + return pytest.main(["-v"]) + +def dev_coverage(): + return run( + "poetry run python3 -m coverage run --branch -m pytest -v ".split() + ).returncode + +def dev_covhtml(): + if e := dev_coverage(): return e + return run( + "poetry run python3 -m coverage html".split() + ).returncode + +def dev_covxml(): + if e := dev_coverage(): return e + return run( + "poetry run python3 -m coverage xml".split() + ).returncode + +def dev_covff(): + if e := dev_covhtml(): return e + return run( + "firefox htmlcov/index.html".split() + ).returncode + +def dev_all(): + if e := dev_covff(): return e + return dev_pylint() |