From e19a7fa8e7a26b7b0a7e273826b735578bc93ffd Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Fri, 12 Oct 2018 15:18:51 +0200 Subject: [PATCH] Add unit-testing to CI --- .gitlab-ci.yml | 11 +++++++++++ live/requirements.txt | 3 +++ tellstick.sh | 7 ++++++- tests/__init__.py | 6 ++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/__init__.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6f8410..96ea715 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,3 +10,14 @@ pylint: - apk add -U git - pip install pylint - pylint --rcfile=.pylintrc $(git ls-tree --name-only --full-tree -r HEAD | grep '\.py' | sort | tr '\n' ' ') || RETCODE=1 + +unittest: + image: python:2.7-alpine + stage: test + script: + - apk add -U bash gcc linux-headers musl-dev npm py2-virtualenv + - ./tellstick.sh setup + - ./tellstick.sh install events + - ./tellstick.sh install scheduler + - ./tellstick.sh install upgrade + - ./tellstick.sh test diff --git a/live/requirements.txt b/live/requirements.txt index 4162553..7ae7e56 100644 --- a/live/requirements.txt +++ b/live/requirements.txt @@ -1,2 +1,5 @@ netifaces +pbkdf2 +pycrypto python-openid +requests diff --git a/tellstick.sh b/tellstick.sh index c7f1667..24f4b64 100755 --- a/tellstick.sh +++ b/tellstick.sh @@ -99,6 +99,7 @@ printHelp() { echo -e " \t\t The server will be restarted automatically when a file changes" echo -e " setup:\tSets up the virtualenv and installs a minium set of required plugins" echo -e " shell:\tStarts a new shell with the virtualenv activated" + echo -e " test:\tRun unit testing" echo -e " uninstall:\tUninstall a plugin. Usage:" echo -e " \t\t $0 uninstall [plugin-name]" echo -e " \t\t where [plugin-name] is the name of the plugin." @@ -115,12 +116,13 @@ run() { setup() { PLUGINS="api base board developer live log sdk telldus web" + pip install -U -r requirements.txt + for plugin in $PLUGINS; do PLUGINPATH="$BASEDIR/$plugin" installPlugin $PLUGINPATH done # Setup git commit hooks - pip install -U -r requirements.txt captainhook install --use-virtualenv-python } @@ -169,6 +171,9 @@ case $1 in PS1='(TellStick) \[\033[01;32m\]\u@\h\[\033[01;34m\] \$\[\033[00m\] ' sh ;; + test) + python -m unittest tests + ;; uninstall) pip uninstall $2 ;; diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..09266f5 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +# Enable once fixed that the server is not started when running. See #199 +# from scheduler.base.tests import SchedulerTest + +from upgrade.tests import HotFixManagerTest