Skip to content

Commit efc6182

Browse files
authored
Merge pull request #1066 from nejch/chore/pytest-for-unit-tests
chore: use pytest to run unit tests and coverage
2 parents 29fd95e + 9787a40 commit efc6182

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
*.pyc
22
build/
33
dist/
4+
htmlcov/
45
MANIFEST
56
.*.swp
67
*.egg-info
78
.idea/
9+
coverage.xml
810
docs/_build
9-
.testrepository/
11+
.coverage
1012
.tox
13+
.venv/
1114
venv/

.testr.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,12 @@ jobs:
8383
script:
8484
- pip3 install tox
8585
- tox -e py38
86+
- stage: test
87+
dist: bionic
88+
name: coverage
89+
python: 3.8
90+
script:
91+
- pip3 install tox
92+
- tox -e cover
8693
allow_failures:
8794
- env: GITLAB_TAG=nightly

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include COPYING AUTHORS ChangeLog.rst RELEASE_NOTES.rst requirements.txt test-requirements.txt rtd-requirements.txt
2-
include tox.ini .testr.conf .travis.yml
2+
include tox.ini .travis.yml
33
recursive-include tools *
44
recursive-include docs *j2 *.py *.rst api/*.rst Makefile make.bat
55
recursive-include gitlab/tests/data *

test-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
coverage
2-
discover
3-
testrepository
42
hacking>=0.9.2,<0.10
53
httmock
64
jinja2
75
mock
6+
pytest
7+
pytest-cov
88
sphinx>=1.3
99
sphinx_rtd_theme

tox.ini

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ install_command = pip install {opts} {packages}
1313
deps = -r{toxinidir}/requirements.txt
1414
-r{toxinidir}/test-requirements.txt
1515
commands =
16-
python setup.py testr --testr-args='{posargs}'
16+
pytest gitlab/tests {posargs}
1717

1818
[testenv:pep8]
1919
commands =
@@ -40,9 +40,11 @@ commands = python setup.py build_sphinx
4040

4141
[testenv:cover]
4242
commands =
43-
python setup.py testr --slowest --coverage --testr-args="{posargs}"
44-
coverage report --omit=*tests*
45-
coverage html --omit=*tests*
43+
pytest --cov gitlab --cov-report term --cov-report html \
44+
--cov-report xml gitlab/tests {posargs}
45+
46+
[coverage:run]
47+
omit = *tests*
4648

4749
[testenv:cli_func_v4]
4850
commands = {toxinidir}/tools/functional_tests.sh -a 4

0 commit comments

Comments
 (0)