diff options
author | Max Wittig <max.wittig@siemens.com> | 2020-04-08 08:20:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 08:20:43 +0200 |
commit | efc6182378509f1e66c55b3443c6afcb2873dc77 (patch) | |
tree | dd77928d59fe1dd895f2cb0156a794016d265ef8 | |
parent | 29fd95e7edbb0369b845afb7e9ee4dbed2e1d483 (diff) | |
parent | 9787a407b700f18dadfb4153b3ba1375a615b73c (diff) | |
download | gitlab-efc6182378509f1e66c55b3443c6afcb2873dc77.tar.gz |
Merge pull request #1066 from nejch/chore/pytest-for-unit-tests
chore: use pytest to run unit tests and coverage
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | .testr.conf | 4 | ||||
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rw-r--r-- | test-requirements.txt | 4 | ||||
-rw-r--r-- | tox.ini | 10 |
6 files changed, 20 insertions, 12 deletions
@@ -1,11 +1,14 @@ *.pyc build/ dist/ +htmlcov/ MANIFEST .*.swp *.egg-info .idea/ +coverage.xml docs/_build -.testrepository/ +.coverage .tox +.venv/ venv/ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 44644a6..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./gitlab/tests $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/.travis.yml b/.travis.yml index a86780e..2935557 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,5 +83,12 @@ jobs: script: - pip3 install tox - tox -e py38 + - stage: test + dist: bionic + name: coverage + python: 3.8 + script: + - pip3 install tox + - tox -e cover allow_failures: - env: GITLAB_TAG=nightly diff --git a/MANIFEST.in b/MANIFEST.in index 2d1b15b..df53d66 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements.txt test-requirements.txt rtd-requirements.txt -include tox.ini .testr.conf .travis.yml +include tox.ini .travis.yml recursive-include tools * recursive-include docs *j2 *.py *.rst api/*.rst Makefile make.bat recursive-include gitlab/tests/data * diff --git a/test-requirements.txt b/test-requirements.txt index 65d09d7..c788436 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,9 @@ coverage -discover -testrepository hacking>=0.9.2,<0.10 httmock jinja2 mock +pytest +pytest-cov sphinx>=1.3 sphinx_rtd_theme @@ -13,7 +13,7 @@ install_command = pip install {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --testr-args='{posargs}' + pytest gitlab/tests {posargs} [testenv:pep8] commands = @@ -40,9 +40,11 @@ commands = python setup.py build_sphinx [testenv:cover] commands = - python setup.py testr --slowest --coverage --testr-args="{posargs}" - coverage report --omit=*tests* - coverage html --omit=*tests* + pytest --cov gitlab --cov-report term --cov-report html \ + --cov-report xml gitlab/tests {posargs} + +[coverage:run] +omit = *tests* [testenv:cli_func_v4] commands = {toxinidir}/tools/functional_tests.sh -a 4 |