Skip to content
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

Fix version comparison handling. #160

Merged
merged 12 commits into from
Nov 7, 2018
Merged

Conversation

Natim
Copy link
Contributor

@Natim Natim commented Nov 5, 2018

Fixes #159

@codecov-io
Copy link

codecov-io commented Nov 5, 2018

Codecov Report

Merging #160 into master will increase coverage by 44.53%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #160       +/-   ##
===========================================
+ Coverage   29.42%   73.95%   +44.53%     
===========================================
  Files           4        4               
  Lines         503      503               
  Branches        0       86       +86     
===========================================
+ Hits          148      372      +224     
+ Misses        355      105      -250     
- Partials        0       26       +26
Impacted Files Coverage Δ
setup.py 0% <ø> (ø) ⬆️
pytest_sugar.py 65.98% <33.33%> (+65.98%) ⬆️
test_sugar.py 99.31% <0%> (-0.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8cb804...4e104fd. Read the comment docs.

Copy link

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

thats the way to go

@Natim
Copy link
Contributor Author

Natim commented Nov 5, 2018

I think it's missing in tox.ini's testenv.deps as well

If it is present in the install_requires of the setup.py tox will install it.

@michael-k
Copy link
Contributor

If it is present in the install_requires of the setup.py tox will install it.

Ah, I see, it's just not updating dependencies. But I guess that's save enough since packaging 14.1 is over 4 years old.

@Natim
Copy link
Contributor Author

Natim commented Nov 5, 2018

For some reason tests might segfault with pypy but it was the case on master before this pull-request.

tox.ini Outdated Show resolved Hide resolved
setup.py Show resolved Hide resolved
pytest_sugar.py Outdated
@@ -398,7 +399,7 @@ def pytest_runtest_logstart(self, nodeid, location):
# show the module_name & in verbose mode the test name.
pass

if pytest.__version__ >= '3.4':
if parse(pytest.__version__) >= parse('3.4'): # pragma: no cover
Copy link

@jaraco jaraco Nov 5, 2018

Choose a reason for hiding this comment

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

I don't like the way the code is written with the "current" version being marked as the deviant behavior. I'd write the code differently:

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

    if parse(pytest.__version__) < parse(3.4):  # pragma: nocover
        # On older Pytest, allow default progress
        del pytest_runtest_logfinish

And then you might even put the if block in a try/except so even if it fails, the more lenient behavior remains.

Copy link

Choose a reason for hiding this comment

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

What would be the harm of including this clause unconditionally, just like its sister method above?

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 makes sense, I will do that.

Copy link

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

Appreciate the work on this - I'm sure it's breaking a lot of builds. My stylistic considerations should not be reason to delay the release of any fix.

.travis.yml Outdated
- env: TOXENV=py37-pytest310-supported-xdist
python: '3.7'
sudo: required
dist: xenial
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use py36 here, since it is easier to setup on Travis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean we shouldn't run tests on Python 3.7 ?
I don't understand what you want to say here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One py37 job is good (which we have).
Here py36-pytest310-supported-xdist could be used.
However, not really important - it just makes the matrix cleaner and the build a bit faster.
Feel free to skip it however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michael-k since this is your code, your voice counts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was chiming in since he copied my code (edb4fe6).. ;)

setup.py Show resolved Hide resolved
@blueyed
Copy link
Collaborator

blueyed commented Nov 6, 2018

Builds are failing due to "rerunfailures" (I've cleared the caches and restarted the previous build already): https://travis-ci.org/Frozenball/pytest-sugar/jobs/451271386#L591

@blueyed
Copy link
Collaborator

blueyed commented Nov 6, 2018

We should only install pytest-rerunfailures with pytest >= 3.6 (tox.ini) I guess.

@Natim
Copy link
Contributor Author

Natim commented Nov 6, 2018

We should only install pytest-rerunfailures with pytest >= 3.6 (tox.ini) I guess.

Why is that? However I think this might be out of the scope of this PR

@blueyed
Copy link
Collaborator

blueyed commented Nov 6, 2018

Because it is not pinned, and they have that requirement by now.
I can look into fixing this later.
Also the py37 method you are using now (via deadsnakes repo) is rather slow, too.

@blueyed
Copy link
Collaborator

blueyed commented Nov 6, 2018

..and it appears to have no ssl support: https://travis-ci.org/Frozenball/pytest-sugar/jobs/451390861#L600

@blueyed
Copy link
Collaborator

blueyed commented Nov 6, 2018

I'll push a fixup.

.travis.yml Outdated
- 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.

tox.ini Outdated
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.

tox.ini Show resolved Hide resolved
@blueyed blueyed merged commit 1d89359 into Teemu:master Nov 7, 2018


# 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants