From 949f0e39838fac49a48a00548a833c8b47593139 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Mon, 19 Feb 2024 00:18:40 +0200 Subject: Package can be installed. Light ./dev.sh for running dev scripts. --- dev/README.md | 18 ---------------- dev/__init__.py | 1 - dev/commands.py | 66 --------------------------------------------------------- 3 files changed, 85 deletions(-) delete mode 100644 dev/README.md delete mode 100644 dev/__init__.py delete mode 100644 dev/commands.py (limited to 'dev') diff --git a/dev/README.md b/dev/README.md deleted file mode 100644 index dd0b2dc..0000000 --- a/dev/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# 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 deleted file mode 100644 index 796c8ef..0000000 --- a/dev/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .commands import dev_command diff --git a/dev/commands.py b/dev/commands.py deleted file mode 100644 index ff94eb2..0000000 --- a/dev/commands.py +++ /dev/null @@ -1,66 +0,0 @@ -from subprocess import run -from sys import argv - -usage = """ -Komentoja kehitykseen: - -poetry run dev - -Komennot: - pytest Ajaa yksikkötestit - pylint Tarkistaa koodin ulkoasun - coverage Tutkii haarakattavuuden - covhtml Tekee coverage haarakattavuusraportin HTML muodossa - covxml Tekee coverage haarakattavuusraportin XML muodossa - covff Tekee haarakattavuusraportin ja avaa sen firefoxilla - all Sama kuin + -""" - -def dev_command(): - if len(argv)==2: - match argv[1]: - case "pytest": - import pytest - return pytest.main(["-v"]) - case "pylint": - return run_pylint() - case "coverage": - return run_coverage() - case "covhtml": - return run_covhtml() - case "covxml": - return run_covxml() - case "covff": - return run_covff() - case "all": - if e := run_covff(): return e - return run_pylint() - print(usage) - return 0 - -def run_pylint(): - import pylint - return pylint.run_pylint(argv=["-v", "src/miinaharava"]) - -def run_coverage(): - return run( - "poetry run python3 -m coverage run --branch -m pytest -v ".split() - ).returncode - -def run_covhtml(): - if e := run_coverage(): return e - return run( - "poetry run python3 -m coverage html".split() - ).returncode - -def run_covxml(): - if e := run_coverage(): return e - return run( - "poetry run python3 -m coverage xml".split() - ).returncode - -def run_covff(): - if e := run_covhtml(): return e - return run( - "firefox htmlcov/index.html".split() - ).returncode -- cgit v1.2.3