Felipe Cannavarro
Felipe Cannavarro

Reputation: 63

How to test a file within a folder with pytest in vscode?

I exchange my Pycharm community IDE for the VScode IDE because the Pycharm do not support Jupyter Notebook. I am almost config all the details that I like in an IDE, but I really caught in it.

The VScode can't find the test when they are within a folder, it does not find the tests.

Test discovery error, please check the configuration settings for the tests

It finds it when the test files are not in a folder, Here is the structure of a "project", It's alright because the tests are out of a folder:

Folder Structure tests structure I wanna put it in a folder =)

Thank you very much.

Upvotes: 3

Views: 1381

Answers (1)

Felipe Cannavarro
Felipe Cannavarro

Reputation: 63

I discover a way to fix this problem in the comments of another random question.

As we have a folder test, so... It's just add a initi.py file, as simple as that:

|__.pytest_cache
|__Main folder
   core.py
   something.py
|__Tests folder
   |__pycache__
   __init__.py
   test_core.py
   test_something.py

Thank you.

Upvotes: 2

Related Questions