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

Cannot run unit tests on Windows with Python 2.7 #322

Closed
emmagordon opened this issue Sep 21, 2015 · 8 comments
Closed

Cannot run unit tests on Windows with Python 2.7 #322

emmagordon opened this issue Sep 21, 2015 · 8 comments
Labels

Comments

@emmagordon
Copy link

Running the axelrod unit tests on Windows with python 2.7 results in the following error:

python -m unittest discover -s axelrod.tests.unit
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s.F..s.s..........................................................................................................................................................................................Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
assert main_name not in sys.modules, main_name
AssertionError: main
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
assert main_name not in sys.modules, main_name
AssertionError: main

This is due to a known bug http://bugs.python.org/issue10845, the fix for which has not yet (may not ever be) ported to 2.7.X

@marcharper
Copy link
Member

Is there anything we can do about this? Something like:

try:
     ....
except AssertionError:
     if os == "Windows":
           pass
     else:
           # re-throw exception

I'm not a fan of this kind of hackery but it doesn't look like the bug will ever be fixed.

@emmagordon
Copy link
Author

May have just laughed out loud a bit ;)

Thinking about it though, I think this would be ok if there was also a print statement in the case where we silence the error (pointing out that the unit tests can't be run with this combination, and that the user should change OS or python version).

The logic also needs changing to check for python2.7+Windows rather than just Windows.

@marcharper
Copy link
Member

That sounds good to me. Unfortunately I don't have any windows machines, so we'll need someone with one to test a patch.

@emmagordon
Copy link
Author

Happy to test a patch on my machine.

@drvinceknight
Copy link
Member

It's certainly hacky... Can't say I'm a fan of 'dirtying' the tests for the sake of an OS... No idea what the right thing to do is though, there are surely some examples of libraries that have the same issue as us?

@drvinceknight
Copy link
Member

@drvinceknight
Copy link
Member

Whilst working on #721, I noted that the failure on 2.7 was now because of the mock module not necessarily being present in 2.7? It's not on there on appveyor...

I would suggest we could possibly close this issue though once we drop support for py2.

@marcharper
Copy link
Member

Closing since we're no longer supporting 2.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants