Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Unable to import modules from root folder if python.autoComplete.extraPaths is set #1484

@DumDumin

Description

@DumDumin

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.8.30787
  • OS and version: Windows 10, version 1903
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: XXX
  • Jedi or Language Server? Language Server

Expected behaviour

I have the following folder structur:

  • projectFolder
    • src
      • _ init_.py
      • main.py
      • subfolder
        • _ init_.py
        • xyz.py
    • tests
      • _ init_.py
      • some_test.py

I added
"python.autoComplete.extraPaths": [ "./src" ],
to my settings.json to get autocompletion in main.py for
from subfolder import xyz

In my test folder I still need to import modules from root with
from src.subfolder import xyz
to let them run correctly.

I would expect to get autocompletion in both cases.

Actual behaviour

But I won't get any autocompletion anymore in my test files, only unresolved reference.
unresolved import 'src.subfolder'Python(unresolved-import)

from subfolder import xyz
gives me autocompletion, but the tests cannot run due to real unresolved imports

I also tried
"python.autoComplete.extraPaths": [ ".", "./src" ],
without any luck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions