Skip to content

Commit

Permalink
Merge pull request #246 from cdent/use-stestr
Browse files Browse the repository at this point in the history
Switch to using stestr instead of testrepository
  • Loading branch information
cdent committed Apr 27, 2018
2 parents 209c87b + 5ec7ee1 commit e3fc929
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AUTHORS
ChangeLog
# Generated by testrepository
.testrepository
.stestr
.idea
.cache/
# coverage related
Expand Down
1 change: 1 addition & 0 deletions .testr.conf → .stestr.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[DEFAULT]
test_path=gabbi/tests
test_command=${PYTHON:-python} -m subunit.run discover gabbi $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ matrix:
env: TOXENV=py35
- python: 3.5
env: TOXENV=py35-pytest
- python: 3.5
env: TOXENV=py35-failskip
- python: 3.5
env: TOXENV=py35-limit
- python: 3.5
env: TOXENV=py35-prefix
- python: 3.6
env: TOXENV=py36-failskip
- python: 3.6
env: TOXENV=py36-limit
- python: 3.6
env: TOXENV=py36-prefix
- python: 3.6
env: TOXENV=py36
- python: 3.6
Expand Down
4 changes: 2 additions & 2 deletions test-failskip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ GREP_UXSUC_MATCH='unexpected successes=1'
# run the live tests.
PYTEST_MATCH="$SKIP skipped, $FAILS xfailed"

python setup.py testr && \
stestr run && \
for match in "${GREP_FAIL_MATCH}" "${GREP_UXSUC_MATCH}" "${GREP_SKIP_MATCH}"; do
testr last --subunit | subunit2pyunit 2>&1 | \
stestr last --subunit | subunit2pyunit 2>&1 | \
grep "${match}"
done

Expand Down
8 changes: 4 additions & 4 deletions test-limit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# broke limiting tests and we never knew.

GREP_TEST_MATCH='tests.test_intercept.self_checklimit.test_request ... ok'
GREP_COUNT_MATCH='Ran 1 '
GREP_COUNT_MATCH='Ran: 1 '

python setup.py testr --testr-args="checklimit" && \
testr last --subunit | subunit2pyunit 2>&1 | \
stestr run "checklimit" && \
stestr last --subunit | subunit2pyunit 2>&1 | \
grep "${GREP_TEST_MATCH}" && \
testr last | grep "${GREP_COUNT_MATCH}"
stestr last | grep "${GREP_COUNT_MATCH}"
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mock ; python_version < '3.3'
testrepository
stestr
coverage
pytest-cov
hacking
Expand Down
20 changes: 14 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py27,py34,py35,py36,pypy,pep8,limit,failskip,docs,py35-prefix,py35-limit,py35-failskip,py27-pytest,py35-pytest,py36-pytest
envlist = py27,py34,py35,py36,pypy,pep8,limit,failskip,docs,py36-prefix,py36-limit,py36-failskip,py27-pytest,py35-pytest,py36-pytest

[testenv]
deps = -r{toxinidir}/requirements.txt
Expand All @@ -10,7 +10,7 @@ whitelist_externals = rm
install_command = pip install -U {opts} {packages}
commands =
rm -f .testrepository/times.dbm
python setup.py testr --testr-args="{posargs}"
stestr run {posargs}
setenv = GABBI_PREFIX=
passenv = GABBI_* HOME

Expand All @@ -28,7 +28,7 @@ commands = py.test gabbi
[testenv:py36-pytest]
commands = py.test gabbi

[testenv:py35-prefix]
[testenv:py36-prefix]
setenv = GABBI_PREFIX=/snoopy

[testenv:pep8]
Expand All @@ -42,14 +42,22 @@ commands = {toxinidir}/test-limit.sh
[testenv:failskip]
commands = {toxinidir}/test-failskip.sh

[testenv:py35-limit]
[testenv:py36-limit]
commands = {toxinidir}/test-limit.sh

[testenv:py35-failskip]
[testenv:py36-failskip]
commands = {toxinidir}/test-failskip.sh

[testenv:cover]
commands = python setup.py testr --coverage --testr-args="{posargs}"
setenv = PYTHON=coverage run --source gabbi --parallel-mode
commands =
coverage erase
find . -type f -name "*.pyc" -delete
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report

[testenv:pytest-cov]
commands = py.test --cov=gabbi gabbi/tests --cov-config .coveragerc --cov-report html
Expand Down

0 comments on commit e3fc929

Please sign in to comment.