#7057 closed defect (fixed)

[CMS] Build failing for `urllib3`

Reported by: atudor Assignee: atudor
Priority: P1 Milestone:
Module: Unknown Keywords:
Cc: kvas, wspee, juliandoucette Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29913558/

Description

Environment

pytest>=3.9.1 - https://pypi.org/project/pytest/#description
urllib3>=1.24 - https://pypi.org/project/urllib3/#description

How to reproduce

  1. Run tox.

Observed behaviour

After the packages are installed, an error causes the tests to fail:

   /Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.24) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
Traceback (most recent call last):
  File "/Users/tavram/Documents/code/cms/.tox/py27/bin/py.test", line 11, in <module>
    sys.exit(main())
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 186, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/hooks.py", line 284, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/manager.py", line 67, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/manager.py", line 61, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/helpconfig.py", line 89, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 656, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 828, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 790, in _preparse
    early_config=self, args=args, parser=self._parser
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/hooks.py", line 284, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/manager.py", line 67, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/manager.py", line 61, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 700, in pytest_load_initial_conftests
    self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 366, in _set_initial_conftests
    self._try_load_conftest(anchor)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 372, in _try_load_conftest
    self._getconftestmodules(anchor)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 399, in _getconftestmodules
    mod = self._importconftest(conftestpath)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 450, in _importconftest
    self.consider_conftest(mod)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 473, in consider_conftest
    self.register(conftestmodule, name=conftestmodule.__file__)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 303, in register
    self.consider_module(plugin)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 479, in consider_module
    self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 484, in _import_plugin_specs
    self.import_plugin(import_spec)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 512, in import_plugin
    six.reraise(new_exc_type, new_exc, sys.exc_info()[2])
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py", line 503, in import_plugin
    __import__(importspec)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 291, in load_module
    six.exec_(co, mod.__dict__)
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/six.py", line 709, in exec_
    exec("""exec _code_ in _globs_, _locs_""")
  File "<string>", line 1, in <module>
  File "/Users/tavram/Documents/code/cms/tests/xtm_conftest.py", line 11, in <module>
    from wsgi_intercept import requests_intercept
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/wsgi_intercept/requests_intercept.py", line 5, in <module>
    from requests.packages.urllib3.connectionpool import (HTTPConnectionPool,
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/requests/utils.py", line 26, in <module>
    from ._internal_utils import to_native_string
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/requests/_internal_utils.py", line 11, in <module>
    from .compat import is_py2, builtin_str, str
  File "/Users/tavram/Documents/code/cms/.tox/py27/lib/python2.7/site-packages/requests/compat.py", line 48, in <module>
    from urllib3.packages.ordered_dict import OrderedDict
ImportError: Error importing plugin "tests.xtm_conftest": No module named ordered_dict

Expected behaviour

The tests would run and pass as expected.

Research conclusion

The latest build of urllib3 are failing. This causes pytest and requests to fail working properly. See the issues/ PRs below for details:

  1. https://github.com/urllib3/urllib3/issues/1456
  2. https://github.com/requests/requests/pull/4829
  3. https://github.com/pytest-dev/pytest/pull/4173

Fix

Update tox.ini to use the previous versions of urllib3 and pytest, until this issue is fixed.

Change History (5)

comment:1 Changed 12 months ago by atudor

The scripts from CMS that would fail under the new build can now be run from within the virtual environment generated by tox. It can be activated by running source .tox/py27/bin/activate.

comment:2 Changed 12 months ago by atudor

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 12 months ago by atudor

  • Cc juliandoucette added

comment:5 Changed 12 months ago by atudor

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.