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

Add {envsitedir} substitution. #72

Closed
pytoxbot opened this Issue Sep 17, 2016 · 10 comments

Comments

Projects
None yet
1 participant
@pytoxbot

pytoxbot commented Sep 17, 2016

It seems tricky to figure out the site-packages dir from outside the virtualenv (distutils.sysconfig is inadequate if the interpreter version changes), but it would make certain hacks to get file-based test runners to cooperate with 2to3 much easier.

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @g2p

@takafumi It can be useful for import-based discovery, but many tools work more reliably or only with a full path. Some tests also try to access resources from the current directory.

pytoxbot commented Sep 17, 2016

Original comment by @g2p

@takafumi It can be useful for import-based discovery, but many tools work more reliably or only with a full path. Some tests also try to access resources from the current directory.

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @tkf

How about changedir = {envtmpdir}? I usually do this when I use 2to3.

pytoxbot commented Sep 17, 2016

Original comment by @tkf

How about changedir = {envtmpdir}? I usually do this when I use 2to3.

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @hpk42

I think we deifnitely need recommendations how to deal with 2to3. Not sure i get to it in the next weeks. Using "envsitepackagesdir" is kind of a hack, it should be possible to have things working more easily. Haven't thought in depth about it yet, though.

pytoxbot commented Sep 17, 2016

Original comment by @hpk42

I think we deifnitely need recommendations how to deal with 2to3. Not sure i get to it in the next weeks. Using "envsitepackagesdir" is kind of a hack, it should be possible to have things working more easily. Haven't thought in depth about it yet, though.

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @g2p

Ah, and without 2to3, this snippet also prevents py.test reporting an import file mismatch between the build/ directory (which pytest tried to collect) and the vcs version (which ends up imported).

pytoxbot commented Sep 17, 2016

Original comment by @g2p

Ah, and without 2to3, this snippet also prevents py.test reporting an import file mismatch between the build/ directory (which pytest tried to collect) and the vcs version (which ends up imported).

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @g2p

auto2to3 -m pytest is another option outside tox, but inside tox it would need some extra flags to only cover vcs files, so it's not very interesting.

pytoxbot commented Sep 17, 2016

Original comment by @g2p

auto2to3 -m pytest is another option outside tox, but inside tox it would need some extra flags to only cover vcs files, so it's not very interesting.

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @g2p

py.test finds the non-2to3 source from the vcs checkout in both cases.
I think it's due to the implicit '' at the start of sys.path.
The other workaround I know, besides this one (haven't tried it as my tests aren't in a separate package), is to change directories (that works well).

pytoxbot commented Sep 17, 2016

Original comment by @g2p

py.test finds the non-2to3 source from the vcs checkout in both cases.
I think it's due to the implicit '' at the start of sys.path.
The other workaround I know, besides this one (haven't tried it as my tests aren't in a separate package), is to change directories (that works well).

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @hpk42

in which case does the normal "--cov=mypkg" not work? And what happens, if you do do "py.test --cov=mypkg --pyargs mypkg" btw?

pytoxbot commented Sep 17, 2016

Original comment by @hpk42

in which case does the normal "--cov=mypkg" not work? And what happens, if you do do "py.test --cov=mypkg --pyargs mypkg" btw?

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @g2p

I have this snippet that works reliably in the presence of 2to3 (edit: the multiprocessing thing was a red herring), should I mention it in one of the examples?

command={envbindir}/py.test --cov={envsitepackagesdir}/mypkg {envsitepackagesdir}/mypkg

pytoxbot commented Sep 17, 2016

Original comment by @g2p

I have this snippet that works reliably in the presence of 2to3 (edit: the multiprocessing thing was a red herring), should I mention it in one of the examples?

command={envbindir}/py.test --cov={envsitepackagesdir}/mypkg {envsitepackagesdir}/mypkg

@pytoxbot pytoxbot closed this Sep 17, 2016

@pytoxbot

This comment has been minimized.

Show comment
Hide comment
@pytoxbot

pytoxbot Sep 17, 2016

Original comment by @hpk42

Add {envsitepackagesdir} substitution. Closes #72.

→ <>

pytoxbot commented Sep 17, 2016

Original comment by @hpk42

Add {envsitepackagesdir} substitution. Closes #72.

→ <>

@pytoxbot

This comment has been minimized.

Show comment
Hide comment

pytoxbot commented Sep 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment