简体   繁体   中英

How to run separate test for each of the folders in VSCode?

I am doing a code challenge. So, I download each of the challenges in the main folder. In VSCode, I have opened the main folder. The test is stuck/limited to the first test I ran. Is it possible that the test looks for test files in each of the sub folders and run according to which file is open.

Bascially, my folder is code . Each of the challenges is:

  • ~/code/1
  • ~/code/2
  • ~/code/3

My test is stuck at ~/code/1/1_test.py . How can I set VS code to pick the test based on the file which I working on?

EDIT: I forgot to mention, I know how to change it. But for each test I need to manually change it by selecting the folder where the test is. Instead I want to know if it can be set to look of pwd of the active file and look for test in the current pwd .

launch.json:

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python: Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal"
            }
        ]
    }

Basically there isn't a way such that you keep your project structure the way you want. If you switch to a multi-root workspace you may be able to set up a launch.json configuration which takes into consider the directory name to construct the format you want. Otherwise your best option is to simply treat each challenge as their own project and thus having their own settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM