Skip to content

Add telemetry for setting python.testing.pytestPath and possibly remove it #4634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
d3r3kk opened this issue Mar 4, 2019 · 3 comments
Closed
Labels
area-testing feature-request Request for new features or functionality

Comments

@d3r3kk
Copy link

d3r3kk commented Mar 4, 2019

With the upcoming change to how we parse Pytest results #4035 we will also have to create a new way to deal with alternate configured Pytest paths.

We will need to update PYTHON_PATH to allow for the loading of Pytest from this custom location during the execution of our test discovery adapter.

Here's the original line we are talking about:
https://github.com/Microsoft/vscode-python/blob/0d565510ba16c133a61e59570904ceaeb42ce034/src/client/unittests/common/runner.ts#L93

There, we will have to implement something of this nature:

if there is a custom pytest path specified,
discover where pytest is being run from (pytest --version should tell us)
parse out the import path reuqired
put the import path at the beginning of PYTHONPATH
add the PYTHONPATH variable to the executed script spawn process

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Mar 4, 2019
@d3r3kk d3r3kk added feature-request Request for new features or functionality needs PR area-testing labels Mar 4, 2019
@ghost ghost removed triage-needed Needs assignment to the proper sub-team labels Mar 4, 2019
@d3r3kk d3r3kk added this to the 2019, week 9 - Feb Sprint 5 milestone Mar 4, 2019
@DonJayamanne DonJayamanne changed the title Modify PYTHON_PATH when a custom path to Pytest is configured. Modify PYTHONPATH when a custom path to Pytest is configured. Mar 5, 2019
@DonJayamanne
Copy link

DonJayamanne commented Mar 5, 2019

  • If 'python.pytestPath' is set then:
    • pass it to the adapter script
    • In python code:
      • Run <pytestPath> --version
      • Get first path from the output
      • Set sys.path[0] to that (before importing pytest)
  • Add telemetry to check how many people use python.pytestPath, python.nosePath

@DonJayamanne DonJayamanne removed this from the 2019, week 11 - March Sprint 6 milestone Mar 13, 2019
@luabud luabud added the triage-needed Needs assignment to the proper sub-team label Jul 8, 2020
@karthiknadig karthiknadig added triage and removed triage-needed Needs assignment to the proper sub-team needs PR labels Jul 9, 2020
@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jul 20, 2020
@karrtikr
Copy link

karrtikr commented Jul 20, 2020

Set sys.path[0] to that (before importing pytest)

The problem with this approach is that adding that directory would import all the packages present in the directory other than pytest also, which conflicts with packages user has in their environment. Which basically means that with the current infrastructure, we cannot support python.testing.pytestPath reliably for discovery.

Leaving that setting there can be misleading, so my suggestion is to add telemetry to see if there are ppl using it - and then possibly remove it.

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Jul 20, 2020
@karrtikr karrtikr removed their assignment Jul 20, 2020
@karrtikr karrtikr changed the title Modify PYTHONPATH when a custom path to Pytest is configured. Add telemetry for setting python.testing.pytestPath and possibly remove it Jul 20, 2020
@luabud
Copy link
Member

luabud commented Jul 20, 2021

Dupe of #5820.

@luabud luabud closed this as completed Jul 20, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants