Skip to content

I also have "Test discovery failed" after upgraded to 2019.6.22090 #6463

Closed

Description

@karrtikr

I also have "Test discovery failed" after upgraded to 2019.6.22090

VS Code version: 1.36.0
Extension version (available under the Extensions sidebar): 2019.6.22090
OS and version: Linux
Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
Relevant/affected Python packages and their versions: pytest - 3.2.1
Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): False

in my case I have the following trace:

python ..../.vscode-server/extensions/ms-python.python-2019.6.22090/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s --cache-clear
Traceback (most recent call last):
  File ".../lib/python3.6/site-packages/_pytest/main.py", line 648, in perform_collect
    config=self.config, items=items)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "..../.vscode-server/extensions/ms-python.python-2019.6.22090/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 76, in pytest_collection_modifyitems
    test, parents = parse_item(item, self.NORMCASE, self.PATHSEP)
  File "..../.vscode-server/extensions/ms-python.python-2019.6.22090/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 191, in parse_item
    for marker in item.own_markers:
AttributeError: 'Function' object has no attribute 'own_markers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../lib/python3.6/site-packages/_pytest/main.py", line 110, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File ".../lib/python3.6/site-packages/_pytest/main.py", line 145, in _main
    config.hook.pytest_collection(session=session)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File ".../lib/python3.6/site-packages/_pytest/main.py", line 155, in pytest_collection
    return session.perform_collect()
  File ".../lib/python3.6/site-packages/_pytest/main.py", line 650, in perform_collect
    hook.pytest_collection_finish(session=self)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File ".../lib/python3.6/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "..../.vscode-server/extensions/ms-python.python-2019.6.22090/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 90, in pytest_collection_finish
    test, parents = parse_item(item, self.NORMCASE, self.PATHSEP)
  File "..../.vscode-server/extensions/ms-python.python-2019.6.22090/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 191, in parse_item
    for marker in item.own_markers:
AttributeError: 'Function' object has no attribute 'own_markers'

Platform:

platform linux -- Python 3.6.5, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 

I confirm that with Extension version 2019.5.18875, (all other things the same) it discovers my tests and run/debug pytest just fine.

Originally posted by Ali Aminfar (@aminfara) in #6417 (comment)

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Jul 5, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jul 8, 2019
  3. defaul commented on Jul 8, 2019

    @defaul

    Same issue. I was trying different versions of pytest and downgrade the python extension without success.

  4. AnneTheAgile commented on Jul 9, 2019

    @AnneTheAgile

    I get test discovery failed alot when I have even a tiny syntax error, eg I think just change spacing where should be 4 to 2.

  5. rdrey commented on Jul 9, 2019

    @rdrey

    I have fixed this locally with getattr(item, 'own_markers', []) for Functions and TestCaseFunctions. Will create a tiny PR to fix it and work on some regression tests to add after work.

  6. rdrey commented on Jul 11, 2019

    @rdrey

    Sorry, haven't had time to add some new unit tests for this yet.

  7. ericsnowcurrently commented on Jul 11, 2019

    @ericsnowcurrently

    The fix needs to be validated.

  8. karrtikr commented on Aug 5, 2019

    @karrtikr
    Author

    validated

  9. ghost removed on Aug 5, 2019
  10. locked as resolved and limited conversation to collaborators on Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priorityregressionBug didn't exist in a previous release

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions