skip to Main Content

Writing tests in Python using pytest framework

For import classes and functions from subdirectory I write this dicertory at the beginning of the path

My problem is that if i don’t write dot at the beginning of the path then code runs fine through VS Code but getting an error if code runs through terminal

If i write dot at the beginning of the path then code runs fine through terminal but getting error if code runs through VS Code

It’s very uncomfortable and i want to specidfy single import order for editor and language

I hope somebody know how make this

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Dot in import means that this directory is package. And my directory is package, because it have file "init.py" You can find more information about package in python on internet


  2. You should read CWD. There are no errors in vscode and in the terminal when I don’t use dots here.

    enter image description here

    Vscode uses the open folder as the workspace, and you are likely to have errors in the workspace.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search