1. Holger Krekel
  2. tox
  3. Issues

Issues

Issue #72 on hold

Add {envsitedir} substitution.

g2p
created an issue

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.

Comments (12)

  1. g2p reporter

    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
    
  2. g2p reporter

    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).

  3. g2p reporter

    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.

  4. g2p reporter

    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).

  5. Holger Krekel repo owner

    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.

  6. g2p reporter

    Takafumi Sato 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.

  7. Log in to comment