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

MarkInfo removed removed in pytest 4.1, breaks pytest-selenium #206

Closed
yourcelf opened this issue Jan 6, 2019 · 13 comments
Closed

MarkInfo removed removed in pytest 4.1, breaks pytest-selenium #206

yourcelf opened this issue Jan 6, 2019 · 13 comments
Assignees
Labels

Comments

@yourcelf
Copy link

yourcelf commented Jan 6, 2019

Version 4.1 of pytest (released yesterday) removes the MarkInfo class which pytest-selenium imports here. This causes pytest to fail:

Traceback (most recent call last):
  File "/builds/repo/repo/venv/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 61, in main
    config = _prepareconfig(args, plugins)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 196, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/hooks.py", line 284, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/manager.py", line 67, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/manager.py", line 61, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/helpconfig.py", line 93, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 652, in pytest_cmdline_parse
    self.parse(args)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 838, in parse
    self._preparse(args, addopts=addopts)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/config/__init__.py", line 784, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pluggy/manager.py", line 267, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 308, in load_module
    six.exec_(co, mod.__dict__)
  File "/builds/repo/repo/venv/lib/python3.6/site-packages/pytest_selenium/drivers/saucelabs.py", line 8, in <module>
    from _pytest.mark import MarkInfo
ImportError: cannot import name 'MarkInfo'

Downgrading to pytest < 4.1 (e.g. 4.0.2) works around the problem.

Failing version info:

  • python 3.6
  • pytest 4.1.0
  • pytest-selenium 1.15.0
@BeyondEvil BeyondEvil self-assigned this Jan 7, 2019
@BeyondEvil BeyondEvil added the bug label Jan 7, 2019
@BeyondEvil
Copy link
Contributor

BeyondEvil commented Jan 7, 2019

Thanks for reporting this @yourcelf I'm working on a fix, hopefully we will release a patch before EOD.

BeyondEvil added a commit to BeyondEvil/pytest-selenium that referenced this issue Jan 7, 2019
@BeyondEvil
Copy link
Contributor

Hey @yourcelf If you have the opportunity I would greatly appreciate if you could test my fix against SauceLabs.

@nicoddemus
Copy link
Member

1.15.1 released with the fix. 👍

@yourcelf
Copy link
Author

yourcelf commented Jan 7, 2019

@BeyondEvil thanks; can confirm that it's fixed for me -- but I wasn't using SauceLabs in the first place; the ImportError was being triggered anyway for local selenium usage.

jgmize added a commit to mozilla/bedrock that referenced this issue Jan 31, 2019
jgmize added a commit to mozilla/bedrock that referenced this issue Jan 31, 2019
pmac pushed a commit to mozilla/bedrock that referenced this issue Jan 31, 2019
* Upgrade pytest-xdist to latest (1.26.1)
* Add pytest-forked as a new dependency of pytest-xdist
* Upgrade pytest for newer pytest-xdist
* Add new pytest dependencies
* Upgrade pathlib2 to satisfy new xdist.looponfail dependency
* Add scandir dependency for upgraded pathlib2
* Upgrade py to satisfy xdist.looponfail dependency
* Upgrade pytest-selenium for compat with pytest 4.1. See  pytest-dev/pytest-selenium#206
* Upgrade pytest-metadata for compatibility with newer pytest. see pytest-dev/pytest#2960
* Upgrade pytest-rerunfailures for compat with newer pytest
* Upgrade pytest-django for newer pydev compatibility
* Replace getfuncargvalue with getfixturevalue for pytest4 compat
weeksghost pushed a commit to weeksghost/pytest-selenium that referenced this issue May 4, 2019
@cauvery
Copy link

cauvery commented Jul 22, 2019

I having seeing the same issue today with pytest 4.1.1 after installing pytest-cov 2.7.1
Tried uninstalling but still the same issue.

Traceback (most recent call last):
  File "/usr/local/bin/pytest", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 63, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 207, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/usr/local/lib/python2.7/site-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/usr/local/lib/python2.7/site-packages/_pytest/helpconfig.py", line 94, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 687, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 895, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/local/lib/python2.7/site-packages/_pytest/config/__init__.py", line 841, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 292, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/local/lib/python2.7/site-packages/importlib_metadata/__init__.py", line 90, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 304, in load_module
    exec(co, mod.__dict__)
  File "/usr/local/lib/python2.7/site-packages/pytest_selenium/drivers/saucelabs.py", line 8, in <module>
    from _pytest.mark import MarkInfo
ImportError: cannot import name MarkInfo

@nicoddemus
Copy link
Member

Please try updating pytest and pytest-cov

@cauvery
Copy link

cauvery commented Jul 22, 2019

Thanks @nicoddemus for the reply.
Got latest versions for pytest and pytest-cov
pytest 4.6.4
pytest-cov 2.7.1
and still seeing same issue

Thanks,
Cauvery.

@nicoddemus
Copy link
Member

Are you sure you updated pytest-selenium? Because last version is 1.16, and the file:

https://github.com/pytest-dev/pytest-selenium/blob/v1.16.0/pytest_selenium/drivers/saucelabs.py

At line 8, is from py.xml import html, which is very different than yours.

@cauvery
Copy link

cauvery commented Jul 22, 2019

ok upgraded pytest-selenium to 1.16 and now got
import _pytest._pluggy as pluggy
ImportError: No module named _pluggy

@cauvery
Copy link

cauvery commented Jul 22, 2019

And also checked my local
/usr/local/lib/python2.7/site-packages/pytest_selenium/drivers/saucelabs.py file and line 8 is same as you mentioned

from py.xml import html

@nicoddemus
Copy link
Member

import _pytest._pluggy as pluggy

Can you show the fulltraceback? pytest used to vendor pluggy, but this is no longer the case for some time now.

And also checked my local...

After you updated? Because your previous traceback clearly showed:

File "/usr/local/lib/python2.7/site-packages/pytest_selenium/drivers/saucelabs.py", line 8, in <module>
    from _pytest.mark import MarkInfo

@cauvery
Copy link

cauvery commented Jul 22, 2019

Upgraded the below and got it working now
pytest-ordering 0.6
pytest-rerunfailures 7.0

Thank you @nicoddemus

  • Cauvery

@cauvery
Copy link

cauvery commented Jul 22, 2019

Actually I was referring to line 8 from file saucelabs.py after the upgrade. Thanks for the help.

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

No branches or pull requests

4 participants