-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
py.test creates an environment that causes colorama to fail #365
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
Comments
Original comment by Paul Moore (BitBucket: pmoore, GitHub: pmoore): On reflection, I'm not sure if this is a py.test bug or a colorama bug, so I have reported it to both projects. I suspect that maybe colorama should ensure on import that it does not try to initialise itself if the standard output is not suitable. But maybe py.test should also have an option to not mess with stdout for cases like this. |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): pytest uses |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): I think it's anyway a good idea to rather use colorama and have that project care for proper win32 interactions instead of duplicating the effort. So i went ahead and changed py/pytest to use colorama. this should help with your use case, could you try? Install it with:
A subsequent |
Original comment by Paul Moore (BitBucket: pmoore, GitHub: pmoore): Wow! Amazing response! The updated py.test seems to work fine. It handles my small test case perfectly and seems to run the pip test suite cleanly now as well. Many thanks for such a quick response. This was causing me real grief, and I wasn't expecting a fix anything like this quickly. |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): Paul, may i ask you to install again (in a clean virtualenv) like this:
and report back if things work? This should get you the pytest-2.4.2 final release candidate which should pull in colorama on windows and use it appropriately. Note that pip's vendored "colorama" might not be able to detect that there is another "colorama" active already (the pip vendored one is probably imported as a sub package). I've left Donald a note on IRC to discuss how to deal with it. If it is a problem i think pip's test suite should make its colorama available via "sys.modules['colorama'] = pip_vendored_colorama_module" which should prevent a double import. Alternatively, colorama could learn to deal with another instance of itself wrapping a stream already. Doing something on the pytest side related to this issue seems like a hack to me, unfortunately. |
Original comment by Paul Moore (BitBucket: pmoore, GitHub: pmoore): That works fine. This is with development pip, which I've just updated to vendor the latest colorama. Last night I was getting failures with development pip because we were vendoring an older version (0.2.5). So yes, I think we need to sort out the possibility of clashes between the vendored colorama and any system one. But I agree, that's a pip issue not a py.test one. |
Originally reported by: Paul Moore (BitBucket: pmoore, GitHub: pmoore)
When running a test file that imports colorama on Windows, the import fails (as far as I can tell, because the Windows standard handle does not point to a proper console)
Here's an example:
This makes the pip test suite fail on Windows, so it is a relatively serious issue for pip.
The text was updated successfully, but these errors were encountered: