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

make build-debs fails at verify stage when both dev and testing requirements are installed #5194

Closed
emkll opened this issue Apr 14, 2020 · 6 comments

Comments

@emkll
Copy link
Contributor

emkll commented Apr 14, 2020

Description

When building debs in a newly created virtualenv, make debs errors out at the testing phase

Steps to Reproduce

  1. Destroy your python3 securedrop virtualenv
  2. make new python3 virtualenv for development
  3. install both testing and development dependencies
  4. run make build-debs
  5. observe error at molecule verify step

Expected Behavior

make build-debs should complete without error

Actual Behavior

The molecule verify step fails, with many occurrences of this stackstrace:

 Replacing crashed slave gw118
gw117 ok / gw119 C / gw121 C / gw120 C [gw117] node down: Traceback (most recent call last):
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/execnet/gateway_base.py", line 1072, in executetask
        do_exec(co, loc)  # noqa
      File "<string>", line 1, in do_exec
      File "<remote exec>", line 184, in <module>
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/hooks.py", line 289, in __call__
        return self._hookexec(self, self.get_hookimpls(), kwargs)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/manager.py", line 87, in _hookexec
        return self._inner_hookexec(hook, methods, kwargs)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/manager.py", line 81, in <lambda>
        firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
        return outcome.get_result()
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
        raise ex[1].with_traceback(ex[2])
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
        res = hook_impl.function(*args)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/_pytest/main.py", line 218, in pytest_cmdline_main
        return wrap_session(config, _main)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/_pytest/main.py", line 211, in wrap_session
        session=session, exitstatus=session.exitstatus
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/hooks.py", line 289, in __call__
        return self._hookexec(self, self.get_hookimpls(), kwargs)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/manager.py", line 87, in _hookexec
        return self._inner_hookexec(hook, methods, kwargs)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/manager.py", line 81, in <lambda>
        firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 153, in _legacymulticall
        hook_impls, caller_kwargs, firstresult=firstresult
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 134, in execute
        return _wrapped_call(hook_impl.function(*args), self.execute)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 100, in _wrapped_call
        return call_outcome.get_result()
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
        raise ex[1].with_traceback(ex[2])
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 52, in from_call
        result = func()
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/pluggy/callers.py", line 135, in execute
        res = hook_impl.function(*args)
      File "/home/user/.virtualenvs/securedrop/lib/python3.7/site-packages/_pytest/stepwise.py", line 102, in pytest_sessionfinish
        self.config.cache.set("cache/stepwise", [])
    AttributeError: 'Config' object has no attribute 'cache'
    
    Replacing crashed slave gw117

Without test requirements, the following stacktrace is observed (seems like test-requirements are required to run the testinfra tests on the molecule verify for build-tests target)

Traceback (most recent call last):
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 510, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2445, in load
    self.require(*args, **kwargs)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2468, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/pkg_resources/__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pytest 3.2.0 (/home/user/.virtualenvs/test/lib/python3.7/site-packages), Requirement.parse('pytest>=3.10'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.virtualenvs/test/bin/pytest", line 8, in <module>
    sys.exit(main())
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/config.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/config.py", line 168, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/config.py", line 945, in pytest_cmdline_parse
    self.parse(args)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/config.py", line 1116, in parse
    self._preparse(args, addopts=addopts)
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/config.py", line 1079, in _preparse
    self.pluginmanager.load_setuptools_entrypoints('pytest11')
  File "/home/user/.virtualenvs/test/lib/python3.7/site-packages/_pytest/vendored_packages/pluggy.py", line 515, in load_setuptools_entrypoints
    "Plugin %r could not be loaded: %s!" % (ep.name, e))
_pytest.vendored_packages.pluggy.PluginValidationError: Plugin 'rerunfailures' could not be loaded: (pytest 3.2.0 (/home/user/.virtualenvs/test/lib/python3.7/site-packages), Requirement.parse('pytest>=3.10'))!

Comments

Suggestions to fix, any other relevant information.

@rmol
Copy link
Contributor

rmol commented Apr 14, 2020

On develop, I can confirm the AttributeError: 'Config' object has no attribute 'cache' error when both sets of requirements are installed.

But if I only install the dev requirements, make build-debs works fine for me. 🤔

@redshiftzero
Copy link
Contributor

I think resolving #5179 will resolve this since the use of version 3.10 of pytest is hitting this issue: ansible/molecule#1566

@kushaldas
Copy link
Contributor

I am seeing the same in my environment for make lint.

@conorsch
Copy link
Contributor

conorsch commented Jun 9, 2020

if I only install the dev requirements, make build-debs works fine for me.

Same behavior here. Why, may I ask, would one want to install the test reqs file into the host's virtualenv? The dependencies in the test-requirements.txt file are only meant to be installed in the context of the application env, not the developer env.

@kushaldas
Copy link
Contributor

Same behavior here. Why, may I ask, would one want to install the test reqs file into the host's virtualenv? The dependencies in the test-requirements.txt file are only meant to be installed in the context of the application env, not the developer env.

I guess we have to update our documentation very clear to say not to do this :)

@emkll
Copy link
Contributor Author

emkll commented Nov 24, 2020

Closed via #5585

@emkll emkll closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants