Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit c05991e

Browse files
committed
use Test Repository for unittest
1 parent 3159c97 commit c05991e

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

.testr.conf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[DEFAULT]
2+
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./yabgp/tests/unit} $LISTOPT $IDOPTION
3+
test_id_option=--load-list $IDFILE
4+
test_list_option=--list

.travis.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
language: python
2+
env:
3+
- TOXENV=py27
4+
- TOXENV=pep8
5+
- TOXENV=cover
6+
- TOXENV=docs
27
install:
38
- pip install tox
49
- pip install coveralls
510
script:
6-
- tox
11+
- tox -e $TOX_ENV
712

813
after_success:
9-
- coveralls
10-
11-
env:
12-
- TOXENV=py27
13-
- TOXENV=flake8
14+
- if [ "x$TOX_ENV" = 'xcover' ]; then coveralls; fi

test-requirements.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
nose==1.3.6
2-
flake8==2.4.0
2+
flake8==2.4.0
3+
4+
coverage
5+
testrepository>=0.0.13
6+
testtools>=0.9.26
7+
8+
# for coveralls.io web service
9+
coveralls

tox.ini

+13-4
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@
66
[tox]
77
# List the environment that will be run by default
88
minversion = 1.6
9-
envlist = py27,docs,flake8
9+
envlist = py27,docs,pep8, cover
1010
skipsdist = True
1111

1212
[testenv]
13+
setenv = VIRTUAL_ENV={envdir}
14+
LANG=en_US.UTF-8
15+
LANGUAGE=en_US:en
16+
LC_ALL=C
1317
deps = -r{toxinidir}/requirements.txt
1418
-r{toxinidir}/test-requirements.txt
1519

16-
commands = nosetests --with-coverage
20+
commands = python setup.py testr --testr-args='{posargs}'
1721

1822
[testenv:docs]
1923
deps=
2024
sphinx
2125
sphinx_rtd_theme
2226
commands = sphinx-build -W -b html doc/source doc/build
2327

24-
[testenv:flake8]
28+
[testenv:pep8]
2529
sitepackages = False
2630
commands =
2731
flake8 {posargs}
@@ -37,4 +41,9 @@ commands =
3741
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
3842

3943
max-line-length=120
40-
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools
44+
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools
45+
46+
[testenv:cover]
47+
commands = coverage erase
48+
python setup.py testr --coverage --omit='yabgp/tests/*' --testr-args='{posargs}'
49+
coverage report -m

0 commit comments

Comments
 (0)