-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support pytest plugins #16852
Comments
It fails to discover tests even if I delete all the test files except for one. |
@dcavanagh Can you share the function and its params? also are you using any pytest plugins? |
I've been able to get some basic tests working. It looks like the error
occurs when using the `behavies_like` decorator from pytest_describe. I will keep looking for other cases
Here are the plugins
pytest = "*"
pytest-cov = "*"
pytest-describe = "*"
pytest-freezegun = "*"
pytest-mock = "*"
pytest-notifier = "*"
…On Mon, Aug 2, 2021 at 10:01 PM Karthik Nadig ***@***.***> wrote:
@dcavanagh <https://github.com/dcavanagh> Can you share the function and
its params? also are you using any pytest plugins?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16852 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACV47WBNTTB63N7PTBERO7LT25EW7ANCNFSM5BNYMOIA>
.
|
Our current discovery code does not support plugins like |
@karthiknadig This particular plugin had been working and then stopped recently. |
Plugins like |
Thanks for the update and this great extension. Looking forward for this to land. |
Will note that in the meantime, this same problem can be solved by pinning |
Possibly related: #19668 |
Thanks to @kr-hansen comment, I found that uninstalling |
Hello! We have just finished our testing rewrite and are beginning the roll out to users. If you are able, it would be very helpful to know if your issue still exists on the rewrite! To try it yourself, you need to be on the most recent release of the Python extension and add this setting to your users You can confirm you have the rewrite enabled by setting Let me know if the rewrite fixes your issue. Thanks! |
Generally plugins should now work on the rewrite, please open issues with specific plugins if this is not the case for you. Thanks Trying the rewrite: |
Environment data
python.languageServer
setting: DefaultExpected behaviour
It discovers tests
Actual behaviour
The Python extension has run into an unexpected situation
while processing a pytest node during test discovery. Please
Please open an issue at:
https://github.com/microsoft/vscode-python/issues
and paste the following output there.
nodeid: test/views/test_stations.py::describe_get_stations_with_count::describe_loggernet_data_platform::data_platform::it_queries_station_count
kind: ('function', False)
class: Function
name: data_platform::it_queries_station_count
fspath: /Users/dan/groundwork/GroundNetEngine/test/views/test_stations.py
location: ('test/views/test_stations.py', 42, 'describe_get_stations_with_count.describe_loggernet_data_platform.data_platform::it_queries_station_count')
function: <function describe_get_stations_with_count..data_platform..it_queries_station_count at 0x106ad3d30>
markers: []
user_properties: []
attrnames: ['_ALLOW_MARKERS', 'annotations', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'slots', 'str', 'subclasshook', 'weakref', '_fixtureinfo', '_getobj', '_initrequest', '_nodeid', '_obj', '_prunetraceback', '_pyfuncitem', '_report_sections', '_repr_failure_py', '_request', '_store', 'add_marker', 'add_report_section', 'addfinalizer', 'cls', 'config', 'extra_keyword_matches', 'fixturenames', 'from_parent', 'fspath', 'funcargs', 'function', 'get_closest_marker', 'getmodpath', 'getparent', 'ihook', 'instance', 'iter_markers', 'iter_markers_with_node', 'keywords', 'listchain', 'listextrakeywords', 'listnames', 'location', 'module', 'name', 'nextitem', 'nodeid', 'obj', 'originalname', 'own_markers', 'parent', 'reportinfo', 'repr_failure', 'runtest', 'session', 'setup', 'teardown', 'user_properties', 'warn']
extra info:
fullname: describe_get_stations_with_count.describe_loggernet_data_platform.data_platform::it_queries_station_count
testfunc: describe_get_stations_with_count.describe_loggernet_data_platform.data_platform.it_queries_station_count
parameterized:
traceback:
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/run_adapter.py", line 22, in
main(tool, cmd, subargs, toolargs)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/main.py", line 100, in main
parents, result = run(toolargs, **subargs)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
ec = _pytest_main(pytestargs, [_plugin])
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/config/init.py", line 162, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main
return wrap_session(config, _main)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 269, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 322, in _main
config.hook.pytest_collection(session=session)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 333, in pytest_collection
session.perform_collect()
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 641, in perform_collect
hook.pytest_collection_finish(session=self)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
test, parents = self.parse_item(item)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
return parse_item(item)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 172, in parse_item
raise should_never_reach_here(
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 132, in should_never_reach_here
traceback.print_stack()
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 637, in perform_collect
INTERNALERROR> hook.pytest_collection_modifyitems(
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 92, in pytest_collection_modifyitems
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 172, in parse_item
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
INTERNALERROR>
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR>
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 333, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/_pytest/main.py", line 641, in perform_collect
INTERNALERROR> hook.pytest_collection_finish(session=self)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/manager.py", line 84, in
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/dan/.local/share/virtualenvs/GroundNetEngine-WLpcZVa5/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
INTERNALERROR> test, parents = self.parse_item(item)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR> return parse_item(item)
INTERNALERROR> File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 172, in parse_item
INTERNALERROR> raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).
========================= 22 tests collected in 4.56s ==========================
Traceback (most recent call last):
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/run_adapter.py", line 22, in
main(tool, cmd, subargs, toolargs)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/main.py", line 100, in main
parents, result = run(toolargs, **subargs)
File "/Users/dan/.vscode-insiders/extensions/ms-python.python-2021.7.1060902895/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 44, in discover
raise Exception("pytest discovery failed (exit code {})".format(ec))
Exception: pytest discovery failed (exit code 3)
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
The text was updated successfully, but these errors were encountered: