-
Notifications
You must be signed in to change notification settings - Fork 171
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
fix is_virtualenv in Windows #178
Conversation
dircontents = os.listdir(path) | ||
try: | ||
dircontents = os.listdir(path) | ||
except (OSError, TypeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TypeError
here might seem odd, but without it I get this:
py27 runtests: commands[0] | nosetests tests
....E........................
======================================================================
ERROR: Windows doesn't allow extremely long paths. This unit test has to be
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Guy\Documents\prospector\tests\finder\test_file_finder.py", line 50, in test_long_path_not_a_venv
self.assertFalse(is_virtualenv(path))
File "C:\Users\Guy\Documents\prospector\prospector\pathutils.py", line 12, in is_virtualenv
dircontents = os.listdir(path)
TypeError: must be (buffer overflow), not str
----------------------------------------------------------------------
Ran 29 tests in 0.141s
@guykisel Thanks for this! The only machine I have running Windows had a motherboard failure a few months ago so never got around to it myself! This seems to be related: https://bugs.python.org/issue1776160 Does this therefore work on Windows now? It seems like Python itself is not bothered, if so there's not much that can be done except catch the exception like you have done :) |
This does work on Windows now as far as I can tell. I'm testing on Windows 10 with Python 2.7.11. It does still seem like the original issue from #159 might still exist, where prospector is not honoring |
You could maybe set up https://www.appveyor.com/ to get some Windows coverage. |
Don't merge yet, I actually have to make the path in the test longer - I forgot that my local repo's path is already a few directories deep. |
Updated with a much longer path to guarantee that this test always goes over the Windows maximum path length. |
@guykisel Finally got around to making a release today, thanks! |
I believe this should fix #159 and #163
I also updated the
is_a_venv
test case so that it'll work properly in Windows.Slightly unrelated, but you might also be interested to know that I'm using prospector in https://github.com/guykisel/inline-plz-bot so thanks for maintaining such a great tool 😄