Bug 1605138 - python2-requests-mock 1.5.0 prevents pytest from launching
Summary: python2-requests-mock 1.5.0 prevents pytest from launching
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-requests-mock
Version: epel7
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jamie Lennox
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-20 09:28 UTC by Janne Pulkkinen
Modified: 2018-08-06 23:49 UTC (History)
2 users (show)

Fixed In Version: python-requests-mock-1.5.2-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-06 23:49:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github jamielennox requests-mock issues 62 0 None None None 2018-07-21 00:35:05 UTC

Description Janne Pulkkinen 2018-07-20 09:28:10 UTC
Description of problem:
The EPEL package python2-requests-mock-1.5.0 includes a pytest plugin that is incompatible with the version of pytest shipped in base/7 repo (pytest-2.7.0).

Trying to run `py.test` with any arguments will cause the program to exit with an assertion failure when both packages are installed.

Version-Release number of selected component (if applicable):
python2-requests-mock 1.5.0-1.el7 (from EPEL-7)
pytest 2.7.0-1.el7 (from base/7)

How reproducible:
Issue can be reproduced consistently.

Steps to Reproduce:
1. yum install -y pytest python2-requests-mock
2. py.test --help 

Actual results:
py.test will fail to start and print a stack trace:

Traceback (most recent call last):
  File "/usr/bin/py.test", line 9, in <module>
    load_entry_point('pytest==2.7.0', 'console_scripts', 'py.test-2.7')()
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 32, in main
    config = _prepareconfig(args, plugins)
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 85, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
    return self._docall(self.methods, kwargs)
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
    firstresult=self.firstresult).execute()
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
    return wrapped_call(method(*args), self.execute)
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 109, in wrapped_call
    wrap_controller.send(call_outcome)
  File "/usr/lib/python2.7/site-packages/_pytest/helpconfig.py", line 28, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
    py.builtin._reraise(*ex)
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
    self.result = func()
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
    res = method(*args)
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 636, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 746, in parse
    self._preparse(args)
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 713, in _preparse
    self.pluginmanager.consider_setuptools_entrypoints()
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 282, in consider_setuptools_entrypoints
    self.register(plugin, name=name)
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 189, in register
    reg(plugin, name)  # may call addhooks
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 611, in _register_plugin
    call_plugin(plugin, "pytest_addoption", {'parser': self._parser})
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 360, in call_plugin
    kwargs=kwargs, firstresult=True).execute()
  File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
    res = method(*args)
  File "/usr/lib/python2.7/site-packages/requests_mock/contrib/_pytest_plugin.py", line 9, in pytest_addoption
    default=False)
  File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 212, in addini
    assert type in (None, "pathlist", "args", "linelist")
AssertionError

Expected results:
py.test should print the normal help message.


Additional info:
The plugin in python2-requests-mock _appears_ to be compatible with pytest versions starting from 2.9.0; I have only tested that `pytest --help` can be successfully run again.

This was tested with upstream versions of the packages in PyPi using python-virtualenv and python2-pip. The following works:

$ virtualenv env; source env/bin/activate;
$ pip install pytest==2.9.0 requests-mock==1.5.0;
$ env/bin/py.test --help; # This works!

but this doesn't work

$ virtualenv env; source env/bin/activate;
$ pip install pytest==2.8.7 requests-mock==1.5.0;
$ env/bin/py.test --help; # This does NOT work!

The upstream source for requests-mock in GitHub does not define a version requirement for pytest. The relevant commit is here:
https://github.com/jamielennox/requests-mock/commit/a455a735d7edba5d064380eb054021a11d076f57

Comment 1 Fedora Update System 2018-07-21 02:43:30 UTC
python-requests-mock-1.5.1-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-22a3804ab4

Comment 2 Fedora Update System 2018-07-21 02:45:08 UTC
python-requests-mock-1.5.1-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-368d4c20cf

Comment 3 Jamie Lennox 2018-07-21 03:14:47 UTC
Hey, sorry about that. It definitely exposes some tests that were missed in the RPM build process. 

Thanks for the detailed report as well, made it much easier to track down. 

I've fixed this upstream, I may as well carry the fix there instead of an RPM patch, and released it as 1.5.1. I've proposed it to F28 (not affected, but keep up to date), EPEL and master.

If you want to check out the candidates and vote on bodhi that would be great, but I've verified it works and added the build tests so it shouldn't happen again.

Comment 4 Fedora Update System 2018-07-21 04:38:38 UTC
python-requests-mock-1.5.2-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-2093d59cfe

Comment 5 Fedora Update System 2018-07-21 04:39:48 UTC
python-requests-mock-1.5.2-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5211c688a8

Comment 6 Jamie Lennox 2018-07-21 04:43:35 UTC
Fix one bug, create on bug. Should now be fixed by 1.5.2. https://github.com/jamielennox/requests-mock/issues/66

Comment 7 Fedora Update System 2018-07-22 02:59:15 UTC
python-requests-mock-1.5.2-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-2093d59cfe

Comment 8 Fedora Update System 2018-07-22 03:39:05 UTC
python-requests-mock-1.5.2-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-5211c688a8

Comment 9 Fedora Update System 2018-07-30 18:25:18 UTC
python-requests-mock-1.5.2-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2018-08-06 23:49:45 UTC
python-requests-mock-1.5.2-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.