swigganicks
swigganicks

Reputation: 1231

Run single folder of pytest tests in vscode

I have a sort of a "micro-service" Python repo with a setup similar to the following:

sample
├── bar
│   ├── src
│   │   └── main.py
│   └── tests
│       └── test_main.py
├── foo
│   ├── src
│   │   └── main.py
│   └── tests
│       └── test_main.py
└── shared
    ├── src
    │   └── main.py
    └── tests
        └── test_main.py

In vscode I only have the option of running all tests in foo,bar,shared or running individual test methods in the subfolders. What I want to do is be able to quickly run just the foo/tests/.

Is there some way I can configure pytest/Python to do this? I don't want to split each top level folder into its own workspace because I regularly jump back and for between them and don't want to have multiple windows per workspace open.

Upvotes: 2

Views: 1890

Answers (1)

KILLtheWEEZEL
KILLtheWEEZEL

Reputation: 268

You should be able to run the command pytest foo/tests/ in the terminal according to the pytest documentation

Upvotes: -3

Related Questions