Update makefile targets for testing

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-23 13:03:11 +01:00
parent e9292fc942
commit 44d6f7d708
4 changed files with 25 additions and 9 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ tests/data/repo
tests/data/repo-krb5-lookaside tests/data/repo-krb5-lookaside
tests/_composes tests/_composes
htmlcov/ htmlcov/
.coverage

View File

@ -21,8 +21,10 @@ help:
@echo " clean remove python bytecode and temp files" @echo " clean remove python bytecode and temp files"
@echo " doc build documentation" @echo " doc build documentation"
@echo " install install program on current system" @echo " install install program on current system"
@echo " test-data build test data (requirement for running tests)"
@echo " test run tests" @echo " test run tests"
@echo " test-coverage run tests and generate a coverage report"
@echo " test-compose run a small teest compose (requires test data)"
@echo " test-data build test data (requirement for running tests)"
@echo @echo
@echo "Available rel-eng targets are:" @echo "Available rel-eng targets are:"
@echo " archive create source tarball" @echo " archive create source tarball"
@ -91,13 +93,16 @@ clean:
test: test:
python2 setup.py test nosetests --exe
python3 setup.py test
test-coverage:
nosetests --exe --with-cov --cov-report html --cov-config tox.ini
test-data: test-data:
./tests/data/specs/build.sh ./tests/data/specs/build.sh
test-compose:
cd tests && ./test_compose.sh
doc: doc:
cd doc; make html cd doc; make html

View File

@ -135,22 +135,25 @@ Currently the development workflow for Pungi is on master branch:
Testing Testing
======= =======
You must write unit tests for any code but trivial changes. Any code without You must write unit tests for any new code (except for trivial changes). Any
sufficient test coverage may not be merged. code without sufficient test coverage may not be merged.
To run all existing tests, suggested method is to use *nosetests*. With To run all existing tests, suggested method is to use *nosetests*. With
additional options, it can generate code coverage. To make sure even tests from additional options, it can generate code coverage. To make sure even tests from
executable files are run, don't forget to use the ``--exe`` option. :: executable files are run, don't forget to use the ``--exe`` option. ::
$ nosetests --exe $ make test
$ nosetests --exe --with-cov --cov pungi --cov-report html $ make test-cover
# Running single test file # Running single test file
$ nosetests --exe test_arch $ python tests/test_arch.py [TestCase...]
In the ``tests/`` directory there is a shell script ``test_compose.sh`` that In the ``tests/`` directory there is a shell script ``test_compose.sh`` that
you can use to try and create a miniature compose on dummy data. The actual you can use to try and create a miniature compose on dummy data. The actual
data will be created by running ``make test-data`` in project root. data will be created by running ``make test-data`` in project root. ::
$ make test-data
$ make test-commpose
This testing compose does not actually use all phases that are available, and This testing compose does not actually use all phases that are available, and
there is no checking that the result is correct. It only tells you whether it there is no checking that the result is correct. It only tells you whether it

7
tox.ini Normal file
View File

@ -0,0 +1,7 @@
[flake8]
exclude = doc/*,*.pyc,*.py~,*.in,*.spec,*.sh,*.rst,setup.py
filename = *.py
ignore = E501
[run]
omit = tests/*