Skip to content

Error when discovering tests with pytest in scikit-learn repo #7487

@ogrisel

Description

@ogrisel

Environment data

  • VS Code version: 1.39.0-insider
  • Extension version (available under the Extensions sidebar): 2019.9.34911 (3 September 2019)
  • OS and version: Linux x64 5.0.0-27
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.7 from conda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda env
  • Relevant/affected Python packages and their versions: pytest 5.1.2
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): language server

Here is the error I get when I discover the tests from within VS code. I don't have any problem running pytest from the command line in the same source folder / conda env.

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/_pytest/main.py", line 440, in perform_collect
INTERNALERROR>     session=self, config=self.config, items=items
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 80, in pytest_collection_modifyitems
INTERNALERROR>     test, parents = self.parse_item(item)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 65, in parse_item
INTERNALERROR>     return parse_item(item)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 162, in parse_item
INTERNALERROR>     location, fullname = _get_location(item, testroot, relfile)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 143, in <lambda>
INTERNALERROR>     _get_location=(lambda *a: _get_location(*a)),
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 283, in _get_location
INTERNALERROR>     location = '{}:{}'.format(srcfile, int(lineno) + 1)
INTERNALERROR> TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/_pytest/main.py", line 191, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/_pytest/main.py", line 234, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/_pytest/main.py", line 244, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/_pytest/main.py", line 443, in perform_collect
INTERNALERROR>     hook.pytest_collection_finish(session=self)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/ogrisel/miniconda3/envs/pip/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 94, in pytest_collection_finish
INTERNALERROR>     test, parents = self.parse_item(item)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 65, in parse_item
INTERNALERROR>     return parse_item(item)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 162, in parse_item
INTERNALERROR>     location, fullname = _get_location(item, testroot, relfile)
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 143, in <lambda>
INTERNALERROR>     _get_location=(lambda *a: _get_location(*a)),
INTERNALERROR>   File "/home/ogrisel/.vscode-insiders/extensions/ms-python.python-2019.9.34911/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 283, in _get_location
INTERNALERROR>     location = '{}:{}'.format(srcfile, int(lineno) + 1)
INTERNALERROR> TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Steps to reproduce:

  1. git clone https://github.com/scikit-learn/scikit-learn
  2. cd scikit-learn
  3. pip install -e .
  4. pip install -U pytest
  5. code-insiders .
  6. Configure test discovery with pytest and the scikit-learn root folder.
  7. Get the above failure in the output panel.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions