ibmresilient / resilient-python-api

Python Library for the IBM SOAR REST API, a Python SDK for developing Apps for IBM SOAR and more...
https://ibm.biz/soar-python-docs
MIT License
39 stars 28 forks source link

pytest_resilient_circuits does not support pytest>=4.1.0 #5

Open AlmogCohen opened 5 years ago

AlmogCohen commented 5 years ago

Description

pytest_resilient_circuits does not support pytest version greater or equal to 4.1.0. It was tested to work perfectly with pytest==4.0.0.

Describe How to Reproduce

Require pytest>=4.1.0 in your virtual environment, try to use pytest_resilient_circuits with any project. Pytest would fail with something like that:

$ pytest
============================================================================================================================ test session starts =============================================================================================================================
platform darwin -- Python 3.6.5, pytest-4.1.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/username/Clients/company/code/company_resilient, inifile: tox.ini
plugins: requests-mock-1.5.2, resilient-circuits-32.0.0, cov-2.6.1
collecting ... INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/_pytest/main.py", line 203, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/_pytest/main.py", line 242, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/hooks.py", line 284, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/manager.py", line 68, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/manager.py", line 62, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/_pytest/main.py", line 252, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/_pytest/main.py", line 466, in perform_collect
INTERNALERROR>     self.config.pluginmanager.check_pending()
INTERNALERROR>   File "/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pluggy/manager.py", line 251, in check_pending
INTERNALERROR>     % (name, hookimpl.plugin),
INTERNALERROR> pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'pytest_resilient_circuits.plugin' from '/Users/username/.local/share/virtualenvs/company_resilient-pK27rW-b/lib/python3.6/site-packages/pytest_resilient_circuits/plugin.py'>

When using pytest==4.0.0 the output is fine:

$ pytest
platform darwin -- Python 3.6.5, pytest-4.0.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/username/Clients/company/code/company_resilient, inifile: tox.ini
plugins: requests-mock-1.5.2, resilient-circuits-32.0.0, cov-2.6.1
collected 7 items

tests/test_company_check_host_internet_connectivity.py ....                                                                                                                                                                                                            [ 57%]
tests/test_company_isolate_host_from_network.py ..                                                                                                                                                                                                                     [ 85%]
tests/test_company_list_associated_applications.py .
AlmogCohen commented 5 years ago

For now I just freeze my projects to use pytest<4.1.0 and it all works fine

allenhadden commented 5 years ago

FWIW, it's likely related to this pytest removal: https://github.com/pytest-dev/pytest/issues/3080

walshbm15 commented 5 years ago

For now we are going to change the requirement to use pytest >=3.0.0, <4.1.0. This will be available in the next update in April.