Skip to content

Fix version comparison handling. #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.tox
.cache
dist/
build
build
.coverage
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ env:
- TOXENV=py35-pytest34-supported-xdist
- TOXENV=py36-pytest30-supported-xdist
- TOXENV=py36-pytest34-supported-xdist
- TOXENV=py36-pytest310-supported-xdist-rerunfailures
- TOXENV=py35-pytest30-unsupported-xdist
- TOXENV=pypy-pytest30-supported-xdist
- TOXENV=pypy-pytest31-supported-xdist
- TOXENV=py37-pytest39-supported-xdist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove that.

- TOXENV=qa
matrix:
include:
Expand Down
16 changes: 10 additions & 6 deletions pytest_sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import re
import sys
from packaging.version import parse

try:
from configparser import ConfigParser
Expand Down Expand Up @@ -398,12 +399,10 @@ def pytest_runtest_logstart(self, nodeid, location):
# show the module_name & in verbose mode the test name.
pass

if pytest.__version__ >= '3.4':

def pytest_runtest_logfinish(self):
# prevent the default implementation to try to show
# pytest's default progress
pass
def pytest_runtest_logfinish(self):
# prevent the default implementation to try to show
# pytest's default progress
pass

def report_key(self, report):
"""Returns a key to identify which line the report should write to."""
Expand Down Expand Up @@ -625,3 +624,8 @@ def print_failure(self, report):
self.write_sep("―", msg)
self._outrep_summary(report)
self.reset_tracked_lines()


# On older version of Pytest, allow default progress
if parse(pytest.__version__) <= parse('3.4'): # pragma: no cover
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity: why the "# pragma: no cover" here?
Shouldn't it either get tested in some build job, or otherwise show up as not being covered then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is covered on some build job but only old version are supposed to cover this.
Do you know if codecov will accumulate all the build coverage?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. it also uses flags for different builds.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address this when rebasing #148.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
I hope we get it released soon.
/cc @Frozenball

del SugarTerminalReporter.pytest_runtest_logfinish
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_version(filename):
zip_safe=False,
include_package_data=True,
platforms='any',
install_requires=['pytest>=2.9', 'termcolor>=1.1.0'],
install_requires=['pytest>=2.9', 'termcolor>=1.1.0', 'packaging>=14.1'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
Expand Down
18 changes: 14 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
[tox]
envlist = py{27,34,35,36,py}-pytest30-supported-xdist,
py{27,35}-pytest30-unsupported-xdist,
py{27,34,py}-pytest31-supported-xdist
py{27,34,py}-pytest34-supported-xdist
py{27,34,py}-pytest31-supported-xdist,
py{27,34,py}-pytest34-supported-xdist,
py37-pytest{39,310}-supported-xdist,
qa

[testenv]
usedevelop = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was done to get the coverage right?
While it is faster, I think it is better to not use this on CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is so that we use the right file for the coverage.

passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT
deps =
codecov>=1.4.0
Expand All @@ -20,16 +22,24 @@ deps =
pytest34: pytest>=3.4,<3.5
pytest37: pytest>=3.7,<3.8
pytest39: pytest>=3.9,<3.10
pytest310: pytest>=3.10,<3.11
termcolor>=1.1.0
supported-xdist: pytest-xdist>=1.14
unsupported-xdist: pytest-xdist<1.14
pytest-rerunfailures
rerunfailures: pytest-rerunfailures
commands =
py.test --cov=./ {posargs:test_sugar.py}
py.test --cov=. --cov-config=tox.ini {posargs:test_sugar.py}
codecov -e TOXENV

[testenv:qa]
deps =
flake8
commands =
flake8 {posargs:conftest.py pytest_sugar.py setup.py test_sugar.py}


[coverage:run]
branch = True
omit =
.tox/*
*xdist*