question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing - Test View for Python with multi-root workspace

See original GitHub issue

Refs: #15750

Complexity: 3

Create Issue


Requirements

  1. Install python extension from here: https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix
  2. Make sure you have "python.experiments.optInto": ["All"], in your user settings. If you did not have it, add it and reload.

Testing

  1. Open either this project https://github.com/karthiknadig/multiroot_pytest_sample or create a project layout similar to that.
  2. Create a virtual environment in the repo directory and install pytest.
    1. Navigate to the repo directory in the terminal.
    2. Then use following commands to create virtual envs
      1. For windows, you can use this command py -3 -m venv .venv
      2. For mac/linux you can use the command python3 -m venv .venv Note: For linux users you may not have venv available out of the box. Please install python3-venv via apt.
    3. Activate the virtual environment:
      1. For windows : run the activate binary .\.venv\Scripts\activate
      2. For linux/mac (bash): run source ./.venv/bin/activate . Note: If you use other terminal shells there are scripts under Scripts or bin directory that should work for your preferred shell.
    4. Once activated you should see the name of the env in the prompt. Run the following command to install pytest: python -m pip install pytest
  3. Activate the python extension and select the virtual environment that you just created. Depending on where you create the virtual environment it may or may not show up in the quick pick. But you can always browse to it and select it.
  4. If you created your own files, then configure each project root for testing using the python: configure test command. Otherwise you should see the tests in the test view.
  5. Run the tests, add more files or test and see the Test UI update accordingly.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Aug 24, 2021

@sandy081 That is not in the scope of this testing plan item. You can skip that.

You can re-select that python by running Python: Select interpreter command

0reactions
karthiknadigcommented, Aug 26, 2021

@roblourens that is a know issue #16170, #16613

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-root Workspaces in Visual Studio Code
You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be helpful when you are working on...
Read more >
python - Use unit tests for a single project when I have multiple ...
python - Use unit tests for a single project when I have multiple project folders in explorer? - Stack Overflow. Stack Overflow for...
Read more >
Visual Studio Code tips for monorepo development with Multi ...
A multi-root workspace is a feature in Visual Studio Code where you can have multiple root folders in one explorer view.
Read more >
Configuring Project Structure | PyCharm Documentation
contain files and folders ignored by PyCharm when indexing, searching, parsing, watching, and so on. Test sources roots the Tests root icon ...
Read more >
Advanced Visual Studio Code for Python Developers
This setup is really useful when writing unit tests with your test code on the ... of its extensions live within a .vscode/...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found