diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | README.rst | 24 | ||||
| -rwxr-xr-x | check | 4 | ||||
| -rw-r--r-- | kerbana/config.py | 6 | 
4 files changed, 30 insertions, 6 deletions
@@ -3,7 +3,9 @@  db.sqlite3  data/ +test_data/  kerbana.yaml +kerbana_tests.yaml  .*.sw? @@ -26,9 +26,27 @@ Contributing  Running Tests  ------------- -To run the MQTT integration tests, create a file ``kerbana_tests.toml`` -in the base directory with the variable ``MQTT_SERVER`` pointing to a -valid mqtt server you can use. +To run the MQTT integration tests, create a file ``kerbana_tests.yaml`` +in the base directory with at least the variable ``MQTT_SERVER`` +pointing to a valid mqtt server you can use, then run the tests with +``KERBANA_CONFIG=kerbana_tests.yaml ./manage.py test``. + +The ``check`` script can be used to run the tests with the above setting +and for other checks and common tasks, with the following subcommands: + +test +   run the test suite +coverage +   run the test suite and print coverage data +qa +   run qa checks (code style etc.) +static +   run static analysis tests +run +   runs the development server +devdb +   initalizes the db and creates ad admin user (whose password needs to +   be set manually afterwards)  License  ------- @@ -24,12 +24,12 @@ shift 1  case $SUBCMD in      "tests")          cd "$root" -        ./manage.py test $@ +        KERBANA_CONFIG=kerbana_tests.yaml ./manage.py test $@          cd -          ;;      "coverage")          cd "$root" -        python3-coverage run ./manage.py test $@ +        KERBANA_CONFIG=kerbana_tests.yaml python3-coverage run ./manage.py test $@          python3-coverage report          cd -          ;; diff --git a/kerbana/config.py b/kerbana/config.py index 358d2fe..af35ab2 100644 --- a/kerbana/config.py +++ b/kerbana/config.py @@ -1,5 +1,6 @@  import logging  import os +import pathlib  import sys  import strictyaml @@ -10,7 +11,10 @@ log = logging.getLogger(__name__)  def read_from_yaml(fp):      data = strictyaml.load(fp.read())      for k, v in data.data.items(): -        setattr(sys.modules[__name__], k, v) +        if k.endswith("PATH"): +            setattr(sys.modules[__name__], k, pathlib.Path(v)) +        else: +            setattr(sys.modules[__name__], k, v)  conf_file = "/etc/kerbana/kerbana.yaml"  | 
