mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-05 15:12:10 +00:00
Add unit tests! yay!
Now, that was seriously missing.
This commit is contained in:
parent
a7ab1c5ace
commit
6889f6fa90
4
Makefile
4
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)
|
||||
|
@ -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
|
||||
---------------------------
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
-r base.txt
|
||||
nose
|
||||
pip-tools
|
||||
pyinstaller
|
||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
12
tests/test_utils.py
Normal file
12
tests/test_utils.py
Normal file
@ -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"))
|
Loading…
Reference in New Issue
Block a user