Skip to content
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

Allow for environmetal variables in testpaths #3405

Closed
gzpac opened this issue Apr 17, 2018 · 7 comments
Closed

Allow for environmetal variables in testpaths #3405

gzpac opened this issue Apr 17, 2018 · 7 comments
Labels
type: question general question, might be closed after 2 weeks of inactivity

Comments

@gzpac
Copy link

gzpac commented Apr 17, 2018

It would be nice to be able to use environmental variables for testpaths parameters.

So that I could write:
testpaths = $MY_VIRTUAL_ENV/usr/lib64/python2.7/my_lib/ (coverage style)

or

testpaths = {env:MY_VIRTUAL_ENV}/usr/lib64/python2.7/my_lib/ (tox style)

pytest version: 3.2.1
python version: cpython 2.7
OS: opensuse 12

@pytestbot pytestbot added the type: question general question, might be closed after 2 weeks of inactivity label Apr 17, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #241 (Allow for a forced xpass), #135 (allow to disable the asserts), #2382 (Allow customizing showlocals cutoff), #3403 (How to pass a variable from a test to another test), and #2435 (f).

@pytestbot pytestbot added the platform: mac mac platform-specific problem label Apr 17, 2018
@blueyed
Copy link
Contributor

blueyed commented Apr 17, 2018

Doesn't $PYTEST_ADDOPTS work for you?
I.e. export PYTEST_ADDOPTS="-o testpaths=$MY_VIRTUAL_ENV/…"

@gzpac
Copy link
Author

gzpac commented Apr 18, 2018

It doesn't because we have several project where we want to run pytest. Therefore we need to to define a configuration specific to a project.

@blueyed
Copy link
Contributor

blueyed commented Apr 18, 2018

@RonnyPfannschmidt
Copy link
Member

@gzpac this is pretty much a hack to set testpaths to a installed package name, instead of allowing env vars there i would rather have support to list an actual package name

then it would be something like

testpaths = --pyargs mylib

for example (we really should find a better way to spell it out tho)

@gzpac
Copy link
Author

gzpac commented Apr 18, 2018

@RonnyPfannschmidt That would work for me. You can even constrain it to installed packages, i.e. something like
testpaths = --pylibs mylib

@nicoddemus
Copy link
Member

@gzpac it seems your question have been answered so I'm closing this. Feel free to follow up with further questions though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question general question, might be closed after 2 weeks of inactivity
Projects
None yet
Development

No branches or pull requests

5 participants