Skip to content

Commit c6b16b6

Browse files
authored
Refactor code coverage configuration (#321)
* Switch from Coveralls.io to Codecov.io * Use `coverage` directly instead of `pytest-cov`, it seems to solve issues
1 parent f4dce04 commit c6b16b6

File tree

7 files changed

+42
-48
lines changed

7 files changed

+42
-48
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[run]
2+
branch = true
3+
include =
4+
pytest_bdd/*
5+
tests/*

.travis.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
dist: xenial
22
language: python
33
python:
4-
- "2.7"
5-
- "3.5"
6-
- "3.6"
7-
- "3.7"
8-
- "3.8-dev"
9-
10-
install: pip install tox tox-travis
11-
4+
- '2.7'
5+
- '3.5'
6+
- '3.6'
7+
- '3.7'
8+
- 3.8-dev
9+
install: pip install tox tox-travis coverage codecov
1210
script: tox --recreate
13-
1411
branches:
1512
except:
16-
- /^\d/
17-
13+
- "/^\\d/"
14+
after_success:
15+
- codecov
1816
notifications:
1917
email:
20-
21-
18+
19+

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ BDD library for the py.test runner
33

44
.. image:: http://img.shields.io/pypi/v/pytest-bdd.svg
55
:target: https://pypi.python.org/pypi/pytest-bdd
6-
.. image:: http://img.shields.io/coveralls/pytest-dev/pytest-bdd/master.svg
7-
:target: https://coveralls.io/r/pytest-dev/pytest-bdd
6+
.. image:: https://codecov.io/gh/pytest-dev/pytest-bdd/branch/master/graph/badge.svg
7+
:target: https://codecov.io/gh/pytest-dev/pytest-bdd
88
.. image:: https://travis-ci.org/pytest-dev/pytest-bdd.svg?branch=master
99
:target: https://travis-ci.org/pytest-dev/pytest-bdd
1010
.. image:: https://readthedocs.org/projects/pytest-bdd/badge/?version=latest

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
addopts=-vvl
2+
testpaths = tests
33
filterwarnings =
44
error
55
ignore::DeprecationWarning

requirements-testing.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
mock
2-
coverage<4.0a1
3-
pytest-cache

tests/feature/test_report.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Test scenario reporting."""
22
import textwrap
3-
4-
import execnet.gateway_base
3+
import pytest
54

65

76
class equals_any(object):
@@ -286,18 +285,23 @@ def should_have_left_cucumbers(start_cucumbers, start, eat, left):
286285

287286
def test_complex_types(testdir):
288287
"""Test serialization of the complex types."""
288+
try:
289+
import execnet.gateway_base
290+
except ImportError:
291+
pytest.skip("Execnet not installed")
292+
289293
testdir.makefile(
290294
".feature",
291295
test=textwrap.dedent(
292296
"""
293297
Feature: Report serialization containing parameters of complex types
294298
295-
Scenario: Complex
296-
Given there is a coordinate <point>
299+
Scenario: Complex
300+
Given there is a coordinate <point>
297301
298-
Examples:
299-
| point |
300-
| 10,20 |
302+
Examples:
303+
| point |
304+
| 10,20 |
301305
"""
302306
),
303307
)

tox.ini

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
[tox]
22
distshare = {homedir}/.tox/distshare
33
envlist = py37-pytestlatest-linters,
4-
py27-pytest{36,37,38,39,310,4,41,42,43,44,45,46},
5-
py37-pytest{36,37,38,39,310,4,41,42,43,44,45,46,5,latest},
6-
py{35,36,38}-pytestlatest,
7-
py27-pytestlatest-xdist
4+
py27-pytest{36,37,38,39,310,4,41,42,43,44,45,46}-coverage,
5+
py37-pytest{36,37,38,39,310,4,41,42,43,44,45,46,5,51,latest}-coverage,
6+
py{35,36,38}-pytestlatest-coverage,
7+
py27-pytestlatest-xdist-coverage
88
skip_missing_interpreters = true
99

1010
[testenv]
11+
setenv =
12+
coverage: _PYTEST_CMD=coverage run --append -m pytest
13+
xdist: _PYTEST_MORE_ARGS=-n3 -rfsxX
1114
deps =
1215
pytestlatest: pytest
16+
pytest51: pytest~=5.1.0
1317
pytest5: pytest~=5.0.0
1418
pytest46: pytest~=4.6.0
1519
pytest45: pytest~=4.5.0
@@ -23,27 +27,12 @@ deps =
2327
pytest38: pytest~=3.8.0
2428
pytest37: pytest~=3.7.0
2529
pytest36: pytest~=3.6.0
30+
31+
coverage: coverage
32+
xdist: pytest-xdist
2633
-r{toxinidir}/requirements-testing.txt
27-
commands = py.test tests --junitxml={envlogdir}/junit-{envname}.xml
34+
commands = {env:_PYTEST_CMD:pytest} {env:_PYTEST_MORE_ARGS:} {posargs:-vvl}
2835

2936
[testenv:py37-pytestlatest-linters]
3037
deps = black
3138
commands = black --check --verbose setup.py docs pytest_bdd tests
32-
33-
[testenv:py27-pytestlatest-xdist]
34-
deps =
35-
pytest-xdist
36-
{[testenv]deps}
37-
commands = {[testenv]commands} -n3 -rfsxX
38-
39-
[testenv:py27-pytestlatest-coveralls]
40-
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
41-
usedevelop = True
42-
changedir = .
43-
deps =
44-
{[testenv]deps}
45-
coveralls
46-
commands =
47-
coverage run --branch --source=pytest_bdd {envbindir}/pytest tests
48-
coverage report -m
49-
coveralls

0 commit comments

Comments
 (0)