diff --git a/Makefile b/Makefile index d7c2475..5d75050 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ compile-requirements: ## Compile requirements files pip-compile -o requirements/dev.txt requirements/dev.in pip-compile -o requirements/docs.txt requirements/docs.in +test: + nosetests --nocapture tests/ + ###### Deployment bundle: ## Bundle the tutor package in a single "dist/tutor" executable @@ -38,6 +41,7 @@ ci-info: ## Print info about environment ci-bundle: ## Create bundle and run basic tests pip3 install -U setuptools pip3 install -r requirements/dev.txt + $(MAKE) test $(MAKE) bundle mkdir -p releases/ cp ./dist/tutor ./releases/tutor-$$(uname -s)_$$(uname -m) diff --git a/docs/tutor.rst b/docs/tutor.rst index 1c2e144..6827b59 100644 --- a/docs/tutor.rst +++ b/docs/tutor.rst @@ -15,6 +15,15 @@ Install requirements pip install -r requirements/dev.txt +Run tests +--------- + +:: + + make test + +Yes, there are very few tests for now, but this is probably going to change. + Bundle ``tutor`` executable --------------------------- diff --git a/requirements/dev.in b/requirements/dev.in index c2e0f6f..1e41c00 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,3 +1,4 @@ -r base.txt +nose pip-tools pyinstaller diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..578a78e --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,12 @@ +import unittest + +from tutor import utils + + +class UtilsTests(unittest.TestCase): + + def test_common_domain(self): + self.assertEqual("domain.com", utils.common_domain("sub1.domain.com", "sub2.domain.com")) + self.assertEqual("sub1.domain.com", utils.common_domain("sub1.domain.com", "sub2.sub1.domain.com")) + self.assertEqual("com", utils.common_domain("domain1.com", "domain2.com")) + self.assertEqual("domain.com", utils.common_domain("sub.domain.com", "ub.domain.com"))