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 deprecation warnings #15

Merged
merged 5 commits into from
Apr 24, 2020
Merged

Fix deprecation warnings #15

merged 5 commits into from
Apr 24, 2020

Conversation

dasm
Copy link
Contributor

@dasm dasm commented Apr 23, 2020

Pytest changed the way how type argument should be provided.
Updated to incorporate upstream changes.


This change is Reviewable

Pytest changed the way how type argument should be provided.
Updated to incorporate upstream changes.
@coveralls
Copy link

coveralls commented Apr 23, 2020

Coverage Status

Coverage remained the same at 58.197% when pulling 07bf34f on dasm:fix_deprecation into 8453474 on pytest-dev:master.

Copy link
Member

@bubenkoff bubenkoff left a comment

Choose a reason for hiding this comment

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

the minimum pytest version should be bumped accordingly then

Copy link
Member

@bubenkoff bubenkoff left a comment

Choose a reason for hiding this comment

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

and, as usual, please add a changelog entry

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

I'm trying to "guesstimate" pytest min version. Maybe you can help me with that.

Changelog for release 3.0.0 (2016-08-18) shows that this change was introduced to pytest: pytest-dev/pytest#1740

optparse type usage now triggers DeprecationWarnings (#1740).

When ran tests with tox to verify if it is working for pytest==2.7.0 I got an error:

pkg_resources.VersionConflict: (pytest 2.7.0 (/apps/pytest-cloud/.tox/py27/lib/python2.7/site-packages), Requirement.parse('pytest>=4.4.0'))
ERROR: InvocationError for command /apps/pytest-cloud/.tox/py27/bin/py.test tests --junitxml=/apps/pytest-cloud/.tox/py27/log/junit-py27.xml (exited with code 1)

Tox is using

tox.ini:7:commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml

Should I assume that minimum version is pytest>=4.4.0 because it is being used by tox (and automated tests?) Pytest 4.4.0 release notes was release 2019-03-29. Or maybe we should assume last supported for python2.7, which would mean pytest>=4.6.0?

It might be messed up with my venv too.

Any thougths @bubenkoff

@bubenkoff
Copy link
Member

bubenkoff commented Apr 23, 2020

@dasm in order to test with tox with different pytest, you'd need to remove pytest from requirements-testing.txt and add it in the corresponding env:

[testenv]
commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml
deps =
    -e.
    -r{toxinidir}/requirements-testing.txt
    pytest==2.7.0
passenv = DISPLAY TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH COVERALLS_REPO_TOKEN USER PWD

@bubenkoff
Copy link
Member

@dasm or maybe it will actually work even without touching requirements-testing, as there's no actual conflict

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

@bubenkoff I did what you asked for. The error is present, because pytest-xdist is depending on pytest>=4.4.0: https://github.com/pytest-dev/pytest-xdist/blob/master/setup.py#L3

install_requires = ["execnet>=1.1", "pytest>=4.4.0", "pytest-forked", "six"]

So, should we just change dependencies list to be dependent on pytest-xdist or update both?

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

With pytest==4.4.0 I don't see deprecation warnings and tests are passing.

@bubenkoff
Copy link
Member

@dasm then we should bump the pytest only, as that's the root cause

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

I've been thinking about this for some time. Technically, it is not a problem with pytest>=2.7.0. It is rather problem with latest xdist. pytest-xdist has internal dependency on pytest>=4.4.0. That's why it is showing an error, when I'm trying to run older version of pytest. Additionally, I found a bug #16 with pytest-xdist>=1.26.0.

My recommendation would be:

  • change setup.py for requirements to pytest-xdist>=1.22.1,<1.26.0
  • remove hard dependency on pytest>=2.7.0 (or as you suggested, update to the same like in pytest-xdist. Disadvantage to tracking pytest-xdist is - every time when it is changing, also pytest-cloud would need to be updated and released).
  • release pytest-cloud 3.2.0

After that release, I could start looking into fix for pytest-xdist>=1.26.0.

As an alternative, we might include temporary workaround for release, which would be #16 (comment)

What do you think about that @bubenkoff ?

@bubenkoff
Copy link
Member

so we then have two problems which we can solve with version requirements:

pytest>=2.7.0 -> config typing which you solved already
pytest-xdist>=1.26.0 -> also found by you how to solve

so please implement both in this PR

Due to changes in external dependency to pytest-xdist,
pytest-xdist<1.26.0 is not supported anymore.
@dasm
Copy link
Contributor Author

dasm commented Apr 24, 2020

@bubenkoff please verify if this change is what you were thinking about.

Copy link
Member

@bubenkoff bubenkoff left a comment

Choose a reason for hiding this comment

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

with the bumping of both pytest and pytest-xdist, it makes sense to raise the major version to 4.0.0

CHANGES.rst Outdated Show resolved Hide resolved
@dasm dasm merged commit e06fec1 into pytest-dev:master Apr 24, 2020
@dasm dasm deleted the fix_deprecation branch April 24, 2020 01:33
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.

3 participants