question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python not added as a language mode option after installing Python extension

See original GitHub issue

Issue Type: Bug

Behaviour

Expected vs. Actual

Expected = .py files are recognized after installing the Python extension, following its README instructions, and then opening a .py file

Actual = .py files are treated as Plain Text and “Python” is not in the list of available language modes when I try to change the language manually

Steps to reproduce:

  1. Install the Python extension
  2. Follow its README instructions
  3. Open a .py file
  4. The file’s language is set to Plain Text
  5. Trying to change the language manually to Python reveals that “Python” is not included in the list of available language modes

Note: I have disabled all other VS Code extensions and restarted both VS Code and my M1 MacBook Pro several times.

Here is the warning that appears in the VS Code Developer Tools console:

Console warning

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: phenoreader/data/tests/test_data_v0.py::describe_find_by_group_label::options_are_respected
kind: ('function', False)
class: Function
name: options_are_respected
fspath: /Users/michael.uloth/Repos/recursionpharma/phenoreader/phenoreader/data/tests/test_data_v0.py
location: ('phenoreader/data/tests/test_data_v0.py', 30, 'options_are_respected')
function: <function describe_find_by_group_label.<locals>.options_are_respected at 0x13bdee3a0>
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: options_are_respected
testfunc: describe_find_by_group_label.options_are_respected
parameterized:

traceback:
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
    main(tool, cmd, subargs, toolargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
    parents, result = run(toolargs, **subargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
    ec = _pytest_main(pytestargs, [_plugin])
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 322, in _main
    config.hook.pytest_collection(session=session)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 333, in pytest_collection
    session.perform_collect()
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 637, in perform_collect
    hook.pytest_collection_modifyitems(
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 92, in pytest_collection_modifyitems
    test, parents = self.parse_item(item)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
    return parse_item(item)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 184, in parse_item
    raise should_never_reach_here(
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 132, in should_never_reach_here
    traceback.print_stack()
collected 74 items

<Module phenoreader/client/tests/test_client.py>
  <Function test_model_hash_to_data_bunch_connection>
  <Function test_pheno_data_to_pairwise_connection>
  <Function test_model_hash_to_to_pairwise_connection>
<Module phenoreader/data/tests/test_data_v0.py>
  <DescribeBlock 'describe_find_by_group_label'>
    <Function options_are_respected>
    <Function valid_group_label>
    <Function unexpected_content>
    <Function invalid_group_label>
    <Function deserialized_phenodata_synonyms_are_lists>
  <Function test_find_by_parameters>
<Module phenoreader/groups/tests/test_groups_v0.py>
  <DescribeBlock 'describe_find_groups'>
    <Function options_are_respected>
    <Function find_200_returns_provided_response>
  <DescribeBlock 'describe_save_groups'>
    <Function save_calls_endpoint_with_provided_value[200]>
    <Function save_calls_endpoint_with_provided_value[201]>
    <Function save_20X_returns_value_rendered_by_endpoint[200]>
    <Function save_20X_returns_value_rendered_by_endpoint[201]>
    <Function test_422_validation_error>
  <Function test_find_groups_by_group_label>
  <Function test_find_groups_by_transformation_id>
<Module phenoreader/tests/test_database.py>
  <Function test_concentration>
  <Function test_experiment_id>
  <Function test_experiment_label>
  <Function test_gene_name>
  <Function test_gene_zfpkm>
  <Function test_group_id>
  <Function test_group_label>
  <Function test_perturbation_pvalue>
  <Function test_rec_id>
  <Function test_transformation_id>
  <Function test_perturbation_type>
  <Function test_well_type>
  <Function test_display_label>
  <Function test_feature_size>
<Module phenoreader/tests/test_utils.py>
  <DescribeBlock 'describe_results_to_pheno_data'>
    <Function returns_pheno_data>
    <Function known_example>
    <Function known_example_without_groups>
<Module phenoreader/transformations/tests/test_transformations_v0.py>
  <Function test_providing_overrides_works>
  <Function test_200_returns_response_body>
  <Function test_404_returns_not_found_error>
  <Function test_422_returns_validation_error>
<Module phenoreader/util/tests/test_beta_transformer.py>
  <DescribeBlock 'describe_beta_transformer'>
    <Function it_assigns_percentiles_on_null>
    <Function it_assigns_percentiles_for_other_data>
  <Function test_add_transforms>
<Module phenoreader/util/tests/test_data_aggregation.py>
  <Function test_data_aggregation[groupby_cols0-False-False]>
  <Function test_data_aggregation[groupby_cols0-False-True]>
  <Function test_data_aggregation[groupby_cols0-True-False]>
  <Function test_data_aggregation[groupby_cols0-True-True]>
  <Function test_data_aggregation[groupby_cols1-False-False]>
  <Function test_data_aggregation[groupby_cols1-False-True]>
  <Function test_data_aggregation[groupby_cols1-True-False]>
  <Function test_data_aggregation[groupby_cols1-True-True]>
  <Function test_data_aggregation_speed[False]>
  <Function test_data_aggregation_speed[True]>
<Module phenoreader/util/tests/test_pairwise_data_processing.py>
  <DescribeBlock 'describe_query_index_and_targets'>
    <Function test_reduce_data_targets_with_intersect_labels_pert_types[mixed_pert_types]>
    <Function test_reduce_data_targets_with_intersect_labels_pert_types[including_soluble_factors]>
    <Function test_reduce_data_targets_with_intersect_labels_pert_types[no_pert_types]>
    <Function test_reduce_data_targets_with_intersect_labels_pert_types[no_labels]>
    <Function test_reduce_data_targets_with_intersect_labels_pert_types[nothing]>
    <Function test_reduce_data_targets_without_intersect_labels_pert_types[mixed_pert_types]>
    <Function test_reduce_data_targets_without_intersect_labels_pert_types[no_pert_types]>
    <Function test_reduce_data_targets_without_intersect_labels_pert_types[no_labels]>
    <Function test_reduce_data_targets_without_intersect_labels_pert_types[nothing]>
    <Function test_get_query_indexes_with_intersect_labels_pert_types[mixed_pert_types]>
    <Function test_get_query_indexes_with_intersect_labels_pert_types[no_pert_types]>
    <Function test_get_query_indexes_with_intersect_labels_pert_types[nothing]>
    <Function test_get_query_indexes_with_intersect_labels_pert_types[no_labels]>
    <Function test_get_query_indexes_without_intersect_labels_pert_types[mixed_pert_types]>
    <Function test_get_query_indexes_without_intersect_labels_pert_types[soluble_factors]>
    <Function test_get_query_indexes_without_intersect_labels_pert_types[no_pert_types]>
    <Function test_get_query_indexes_without_intersect_labels_pert_types[nothing]>
    <Function test_get_query_indexes_without_intersect_labels_pert_types[no_labels]>
  <Function test_get_cosine_similarities>
  <Function test_get_manhattan_distances>
  <Function test_restock_pairwise_metadata>
  <Function test_get_pairwise_data>
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: phenoreader/data/tests/test_data_v0.py::describe_find_by_group_label::options_are_respected
kind: ('function', False)
class: Function
name: options_are_respected
fspath: /Users/michael.uloth/Repos/recursionpharma/phenoreader/phenoreader/data/tests/test_data_v0.py
location: ('phenoreader/data/tests/test_data_v0.py', 30, 'options_are_respected')
function: <function describe_find_by_group_label.<locals>.options_are_respected at 0x13bdee3a0>
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: options_are_respected
testfunc: describe_find_by_group_label.options_are_respected
parameterized:

traceback:
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
    main(tool, cmd, subargs, toolargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
    parents, result = run(toolargs, **subargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 30, in discover
    ec = _pytest_main(pytestargs, [_plugin])
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/config/__init__.py", line 162, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 322, in _main
    config.hook.pytest_collection(session=session)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 333, in pytest_collection
    session.perform_collect()
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 641, in perform_collect
    hook.pytest_collection_finish(session=self)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
    test, parents = self.parse_item(item)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
    return parse_item(item)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 184, in parse_item
    raise should_never_reach_here(
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/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/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 637, in perform_collect
INTERNALERROR>     hook.pytest_collection_modifyitems(
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 92, in pytest_collection_modifyitems
INTERNALERROR>     test, parents = self.parse_item(item)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR>     return parse_item(item)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 184, 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/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 333, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/_pytest/main.py", line 641, in perform_collect
INTERNALERROR>     hook.pytest_collection_finish(session=self)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 107, in pytest_collection_finish
INTERNALERROR>     test, parents = self.parse_item(item)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 77, in parse_item
INTERNALERROR>     return parse_item(item)
INTERNALERROR>   File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/pytest/_pytest_item.py", line 184, in parse_item
INTERNALERROR>     raise should_never_reach_here(
INTERNALERROR> NotImplementedError: Unexpected pytest node (see printed output).

========================= 74 tests collected in 1.10s ==========================

Traceback (most recent call last):
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/run_adapter.py", line 22, in <module>
    main(tool, cmd, subargs, toolargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/pythonFiles/testing_tools/adapter/__main__.py", line 100, in main
    parents, result = run(toolargs, **subargs)
  File "/Users/michael.uloth/.vscode/extensions/ms-python.python-2022.8.0/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)

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.13
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

[Info  - 12:27:35 PM] (2044) Pylance language server 2022.6.30 (pyright 212d1465) starting
[Info  - 12:27:35 PM] (2044) Server root directory: /Users/michael.uloth/.vscode/extensions/ms-python.vscode-pylance-2022.6.30/dist
Notebook support: Legacy
[Info  - 12:27:35 PM] (2044) No configuration file found.
[Info  - 12:27:35 PM] (2044) No pyproject.toml file found.
[Info  - 12:27:35 PM] (2044) Setting pythonPath for service "phenoreader": "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/bin/python"
[Warn  - 12:27:35 PM] (2044) stubPath /Users/michael.uloth/Repos/recursionpharma/phenoreader/typings is not a valid directory.
[Info  - 12:27:36 PM] (2044) Assuming Python version 3.9
[Info  - 12:27:36 PM] (2044) Assuming Python platform Darwin
[Info  - 12:27:37 PM] (2044) Searching for source files
[Info  - 12:27:37 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 12:27:37 PM] (2044) Found 32 source files
[Info  - 12:27:37 PM] (2044) Background analysis(1) root directory: /Users/michael.uloth/.vscode/extensions/ms-python.vscode-pylance-2022.6.30/dist
[Info  - 12:27:37 PM] (2044) Background analysis(1) started
[Info  - 3:03:25 PM] (2044) Searching for source files
[Info  - 3:03:25 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:03:25 PM] (2044) Found 32 source files
[Info  - 3:03:27 PM] (2044) Searching for source files
[Info  - 3:03:27 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:03:27 PM] (2044) Found 32 source files
[Info  - 3:03:30 PM] (2044) Searching for source files
[Info  - 3:03:30 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:03:30 PM] (2044) Found 32 source files
[Info  - 3:05:39 PM] (2044) No configuration file found.
[Info  - 3:05:39 PM] (2044) No pyproject.toml file found.
[Info  - 3:05:39 PM] (2044) Setting pythonPath for service "phenoreader": "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/bin/python"
[Warn  - 3:05:39 PM] (2044) stubPath /Users/michael.uloth/Repos/recursionpharma/phenoreader/typings is not a valid directory.
[Info  - 3:05:39 PM] (2044) Assuming Python version 3.9
[Info  - 3:05:39 PM] (2044) Assuming Python platform Darwin
[Info  - 3:05:39 PM] (2044) Searching for source files
[Info  - 3:05:39 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:05:39 PM] (2044) Found 32 source files
[Info  - 3:05:39 PM] (2044) No configuration file found.
[Info  - 3:05:39 PM] (2044) No pyproject.toml file found.
[Info  - 3:05:39 PM] (2044) Setting pythonPath for service "phenoreader": "/Users/michael.uloth/Repos/recursionpharma/phenoreader/venv/bin/python"
[Warn  - 3:05:39 PM] (2044) stubPath /Users/michael.uloth/Repos/recursionpharma/phenoreader/typings is not a valid directory.
[Info  - 3:05:39 PM] (2044) Assuming Python version 3.9
[Info  - 3:05:39 PM] (2044) Assuming Python platform Darwin
[Info  - 3:05:39 PM] (2044) Searching for source files
[Info  - 3:05:39 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:05:39 PM] (2044) Found 32 source files
[Info  - 3:05:39 PM] (2044) Searching for source files
[Info  - 3:05:39 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:05:39 PM] (2044) Found 32 source files
[Info  - 3:05:41 PM] (2044) Searching for source files
[Info  - 3:05:41 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:05:41 PM] (2044) Found 32 source files
[Info  - 3:17:44 PM] (2044) Searching for source files
[Info  - 3:17:44 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:17:44 PM] (2044) Found 32 source files
[Info  - 3:18:32 PM] (2044) Searching for source files
[Info  - 3:18:32 PM] (2044) Auto-excluding /Users/michael.uloth/Repos/recursionpharma/phenoreader/venv
[Info  - 3:18:32 PM] (2044) Found 32 source files

User Settings


languageServer: "Pylance"

testing
• pytestEnabled: true

Extension version: 2022.8.0 VS Code version: Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630, 2022-06-14T12:48:37.209Z) OS version: Darwin arm64 21.5.0 Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 5, 14, 15
Memory (System) 32.00GB (1.31GB free)
Process Argv –crash-reporter-id 8c6d18e2-9f30-4561-8e14-ff823acd89ca
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549
c4g48928:30513948

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
oolothcommented, Jun 27, 2022

You can disable pytest by explicitly adding “python.testing.pytestEnabled”: false. VS Code should be able to detect python even if python extension is not installed. So, try disabling pyhton extension and see if it identifies the file as python. if not, then this might have to be moved to VS Code repo.

@karthiknadig Thank you so much for your help. Unfortunately, explicitly disabling pytest didn’t help.

Since it became somewhat urgent for me to solve this issue for work, I ended up completely removing all traces of my VS Code installation from my Mac and starting again from scratch with a fresh install. From there, I had no issues with the Python extension.

I’m not sure what was wrong with how my existing settings/extensions/etc were interacting, but I appreciate your time in trying to help me figure that out.

0reactions
karthiknadigcommented, Jun 27, 2022

You can disable pytest by explicitly adding "python.testing.pytestEnabled": false. VS Code should be able to detect python even if python extension is not installed. So, try disabling pyhton extension and see if it identifies the file as python. if not, then this might have to be moved to VS Code repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python no longer detected as a language in VS Code
Go to your extension manager (ctrl+shift+x) search for Python and make sure the official Python extension is installed.
Read more >
Extension cannot override language name anymore #5278
Install extension Python. This issue has been present for a while, including the previous version. I just uninstalled and reinstalled VS Code, and...
Read more >
Settings Reference for Python - Visual Studio Code
Python settings reference. The Python Extension for Visual Studio Code is highly configurable. This page describes the key settings you can work with....
Read more >
4. Using Python on Windows — Python 3.11.1 documentation
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix...
Read more >
Setting Up VSCode For Python Programming - YouTube
In this video I will show you how to setup VSCode to write Python code with some helpful extensions that include features like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found