CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
791 stars 75 forks source link

Multiprocessing error on Python 2.7 and Windows #103

Closed JayZar21 closed 8 years ago

JayZar21 commented 8 years ago

I tested green on Linux and I had no issue. I used green for testing the same code base on Windows and I had issues with the multiprocessing module (forking):

>green -s 1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  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 "<string>", line 1, in <module>
  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 "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\green.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\green\cmdline.py", line 75, in main
    result = run(test_suite, stream, args, testing)
  File "c:\python27\lib\site-packages\green\runner.py", line 91, in run
    manager = multiprocessing.Manager()
  File "c:\python27\lib\multiprocessing\__init__.py", line 99, in Manager
    m.start()
  File "c:\python27\lib\multiprocessing\managers.py", line 528, in start
    self._address = reader.recv()
EOFError
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  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__

It seems to be an issue of python which is not backported. However I use python 2.7.10 (the latest) and a workaround would be appreciated!

gary-liguoliang commented 8 years ago

If you're using python < 2.7.11, it might caused by this bug: https://bugs.python.org/issue10128

This is how did i run nosetests for mutliprocessing with python < 2.7.11, you may try to crate one for green. from nose import main if __name__ == '__main__': main()

CleanCut commented 8 years ago

@JayZar21 Sorry about the huge delay. Are you still affected by this issue? If so, will you please provide some code that causes the issue?

CleanCut commented 8 years ago

If this still affects you and you can provide some way for us to duplicate the problem, please reopen this issue.

JayZar21 commented 8 years ago

Sorry, I'm late. I have just tested: this issue seems to be solved. I have other problems with unicode... but this is another story and I have to verify my issues!! Thank you!

CleanCut commented 8 years ago

Okay. Make sure to test the latest version -- we had some windows unicode fixes in the last release.