diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-16 21:06:34 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-16 21:06:34 +0200 |
commit | 2fd254af8613dba6bbd7bd9f52514229a5287d21 (patch) | |
tree | 25e1fe932bbab88c9346a30ecdcd9bfbc7a2238d | |
parent | 3959cfd0c0cab47f863ea5672350ad280b4b7773 (diff) |
dev tools, pytest and pylint
-rwxr-xr-x | dev.sh | 35 | ||||
-rw-r--r-- | pyproject.toml | 11 | ||||
-rw-r--r-- | tests/test_enemies.py | 8 |
3 files changed, 36 insertions, 18 deletions
@@ -1,23 +1,27 @@ #!/bin/sh [ x$1 = x ] && echo "\ -Pieni ja kevyt skripti helppoa kehitystyökalujen ajoa varten. +Small script for running developement tools. -Käyttö: $0 <komento> +Usage: $0 <command> -Komennot: +Commands: -dev Asenna devausymäristö -pytest Aja yksikkötestit pytestillä -pylint Tarkista muotoilu pylintillä -covhtml Tee haarakattavuus raportti html muodossa -covxml Sama mutta xml muoto (codecov tarvitsee tämän) -covff Tee html haarakattavuusraportti ja avaa se firefoxissa -all Sama kuin '$0 covff && $0 pylint' -install Rakenna ja asenna paketti käyttäen pipx & poetry +dev Install developement envoronment +pytest Run pytest unittests +pylint Do pylint +covhtml Make branch coverage report in html format +covff Open html coverage report in firefox +all Do it all: pytest, coverage report in firefox and pylint +install Build poetry package and install it for current user " && exit 0 -[ x$PIP = x ] && PIP="pipx" +PIP=`which pipx` +[ x$PIP = x ] && PIP=`which pip` +[ x$PIP = x ] \ + && echo "This scripts needs pipx or pip to install dependencies." \ + && exit 1 + export DEVSH_PRIN=">>$DEVSH_PRIN" export DEVSH_PROUT="<<$DEVSH_PROUT" @@ -49,7 +53,7 @@ case $1 in ;; pylint) - poetry run python3 -m pylint src/miinaharava/ + poetry run python3 -m pylint src/sliceitoff/ ;; coverage) @@ -61,11 +65,6 @@ case $1 in && poetry run python3 -m coverage html ;; - covxml) - $0 coverage \ - && poetry run python3 -m coverage xml - ;; - covff) $0 covhtml \ && firefox htmlcov/index.html diff --git a/pyproject.toml b/pyproject.toml index 483d69f..f6ab331 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,3 +19,14 @@ coverage = "^7.4.4" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +miinaharava = 'sliceitoff.main:main' + +[tool.pytest.ini_options] +pythonpath = [ "src/sliceitoff" ] + + +[tool.pylint.main] +recursive = true +source-roots = ["src/sliceitoff"] diff --git a/tests/test_enemies.py b/tests/test_enemies.py new file mode 100644 index 0000000..24c608c --- /dev/null +++ b/tests/test_enemies.py @@ -0,0 +1,8 @@ +import unittest + +from enemies.enemies import EnemySprite + +class TestEnemySprite(unittest.TestCase): + def test_can_create(self): + enemy = EnemySprite() + self.assertNotEqual(None, enemy) |