Skip to content

Commit 4fe4eea

Browse files
authored
only run coverage for relevant test (python-telegram-bot#818)
* fix test troubles * another try * testing travis build? * trying pytestmark
1 parent e39b6ab commit 4fe4eea

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ before_cache:
2424
- rm -f $HOME/.pre-commit/pre-commit.log
2525

2626
install:
27-
- pip install coveralls pytest-cov
27+
- pip install -U coveralls pytest-cov
2828
- pip install -U wheel
2929
- pip install -U -r requirements.txt
3030
- pip install -U -r requirements-dev.txt
3131
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then pip install ujson; fi
3232

3333
script:
34-
- pytest -v --cov=telegram
34+
- pytest -v -m nocoverage
35+
- pytest -v -m "not nocoverage" --cov
3536

3637
after_success:
3738
- coverage combine

tests/test_meta.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919
import os
20-
import subprocess
2120
import sys
2221
from platform import python_implementation
2322

@@ -26,17 +25,22 @@
2625

2726
def call_pre_commit_hook(hook_id):
2827
__tracebackhide__ = True
29-
return os.system(' '.join(['pre-commit', 'run', '--all-files', hook_id]))
28+
return os.system(' '.join(['pre-commit', 'run', '--all-files', hook_id])) # pragma: no cover
3029

3130

31+
@pytest.mark.nocoverage
3232
@pytest.mark.parametrize('hook_id', argvalues=('yapf', 'flake8', 'pylint'))
3333
@pytest.mark.skipif(not os.getenv('TRAVIS'), reason='Not running in travis.')
3434
@pytest.mark.skipif(not sys.version_info[:2] == (3, 6) or python_implementation() != 'CPython',
35-
reason='Only running pre-commit-hooks on newest tested python version, '
36-
'as they are slow and consistent across platforms.')
35+
reason='Only running pre-commit-hooks on newest tested python version, '
36+
'as they are slow and consistent across platforms.')
3737
def test_pre_commit_hook(hook_id):
38-
assert call_pre_commit_hook(hook_id) == 0
38+
assert call_pre_commit_hook(hook_id) == 0 # pragma: no cover
3939

4040

41+
@pytest.mark.nocoverage
42+
@pytest.mark.skipif(
43+
not sys.version_info[:2] in ((3, 6), (2, 7)) or python_implementation() != 'CPython',
44+
reason='Only testing build on 2.7 and 3.6')
4145
def test_build():
42-
assert os.system('python setup.py bdist_dumb') == 0
46+
assert os.system('python setup.py bdist_dumb') == 0 # pragma: no cover

0 commit comments

Comments
 (0)