From a4a160b06190ad68434968e0311e4300a2228982 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Tue, 10 Mar 2015 16:03:54 +0200 Subject: [PATCH] adding command for running of tests --- manage.py | 15 +++++++++++++++ tests/test_sample.py | 6 ------ 2 files changed, 15 insertions(+), 6 deletions(-) delete mode 100644 tests/test_sample.py diff --git a/manage.py b/manage.py index 832bfe7b..fe88dd52 100644 --- a/manage.py +++ b/manage.py @@ -34,5 +34,20 @@ def check(): os.system('flake8 examples/') os.system('pep257 examples/') + +@manager.command +def test(): + """Run unittests.""" + os.system('find ./objects -name "*.pyc" -exec rm -rf {} \\;') + os.system('find ./tests -name "*.pyc" -exec rm -rf {} \\;') + + os.system('find ./objects -name "*.pyo" -exec rm -rf {} \\;') + os.system('find ./tests -name "*.pyo" -exec rm -rf {} \\;') + + os.system('coverage run --rcfile=./.coveragerc `which unit2` discover') + os.system('coverage html --rcfile=./.coveragerc') + os.system('rm -f .coverage') + + if __name__ == '__main__': manager.main() diff --git a/tests/test_sample.py b/tests/test_sample.py deleted file mode 100644 index 7b817c65..00000000 --- a/tests/test_sample.py +++ /dev/null @@ -1,6 +0,0 @@ -def func(x): - return x + 1 - - -def test_answer(): - assert func(3) == 5