mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-13 11:18:20 +01:00
only run coverage for relevant test (#818)
* fix test troubles * another try * testing travis build? * trying pytestmark
This commit is contained in:
parent
e39b6abe61
commit
4fe4eea893
2 changed files with 13 additions and 8 deletions
|
@ -24,14 +24,15 @@ before_cache:
|
|||
- rm -f $HOME/.pre-commit/pre-commit.log
|
||||
|
||||
install:
|
||||
- pip install coveralls pytest-cov
|
||||
- pip install -U coveralls pytest-cov
|
||||
- pip install -U wheel
|
||||
- pip install -U -r requirements.txt
|
||||
- pip install -U -r requirements-dev.txt
|
||||
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then pip install ujson; fi
|
||||
|
||||
script:
|
||||
- pytest -v --cov=telegram
|
||||
- pytest -v -m nocoverage
|
||||
- pytest -v -m "not nocoverage" --cov
|
||||
|
||||
after_success:
|
||||
- coverage combine
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from platform import python_implementation
|
||||
|
||||
|
@ -26,17 +25,22 @@ import pytest
|
|||
|
||||
def call_pre_commit_hook(hook_id):
|
||||
__tracebackhide__ = True
|
||||
return os.system(' '.join(['pre-commit', 'run', '--all-files', hook_id]))
|
||||
return os.system(' '.join(['pre-commit', 'run', '--all-files', hook_id])) # pragma: no cover
|
||||
|
||||
|
||||
@pytest.mark.nocoverage
|
||||
@pytest.mark.parametrize('hook_id', argvalues=('yapf', 'flake8', 'pylint'))
|
||||
@pytest.mark.skipif(not os.getenv('TRAVIS'), reason='Not running in travis.')
|
||||
@pytest.mark.skipif(not sys.version_info[:2] == (3, 6) or python_implementation() != 'CPython',
|
||||
reason='Only running pre-commit-hooks on newest tested python version, '
|
||||
'as they are slow and consistent across platforms.')
|
||||
reason='Only running pre-commit-hooks on newest tested python version, '
|
||||
'as they are slow and consistent across platforms.')
|
||||
def test_pre_commit_hook(hook_id):
|
||||
assert call_pre_commit_hook(hook_id) == 0
|
||||
assert call_pre_commit_hook(hook_id) == 0 # pragma: no cover
|
||||
|
||||
|
||||
@pytest.mark.nocoverage
|
||||
@pytest.mark.skipif(
|
||||
not sys.version_info[:2] in ((3, 6), (2, 7)) or python_implementation() != 'CPython',
|
||||
reason='Only testing build on 2.7 and 3.6')
|
||||
def test_build():
|
||||
assert os.system('python setup.py bdist_dumb') == 0
|
||||
assert os.system('python setup.py bdist_dumb') == 0 # pragma: no cover
|
||||
|
|
Loading…
Add table
Reference in a new issue