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

coverage.py cannot be imported in Jython2.7 due to missing multiprocessing library #551

Closed
nedbat opened this issue Jan 12, 2017 · 7 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Jan 12, 2017

Originally reported by Chris (Bitbucket: offbyone, GitHub: offbyone)


When running Jython 2.7.1b3 and using multiprocessing by way of pytest-cov:

  File "/lib/jython2.7/site-packages/pytest_cov/plugin.py", line 5, in <module>
    from coverage.misc import CoverageException
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/__init__.py", line 13, in <module>
    from coverage.control import Coverage, process_startup
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/control.py", line 27, in <module>
    from coverage.multiproc import patch_multiprocessing
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/multiproc.py", line 6, in <module>
    import multiprocessing
ImportError: No module named multiprocessing

According to a Jython issue this is a known gap.

There seems to be no way to prevent the attempt to import multiprocessing, as it happens in unconditional imports in __init__.py -> control.py -> multiproc.py


@nedbat
Copy link
Owner Author

nedbat commented Jan 13, 2017

@offbyone it's been a long time since I've been able to support Jython. The Jython people aren't making this easy... I tried running my tox tests against 2.7.0, and couldn't even install the requirements:

☿ .tox/jython/bin/python -m pip install -rrequirements/pytest.pip
Exception:
Traceback (most recent call last):
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/commands/install.py", line 310, in run
    self.populate_requirement_set(
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/basecommand.py", line 292, in populate_requirement_set
    for req in parse_requirements(
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/req_file.py", line 89, in parse_requirements
    for line_number, line in lines_enum:
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/req_file.py", line 323, in ignore_comments
    for line_number, line in lines_enum:
  File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/req_file.py", line 298, in join_lines
    if COMMENT_RE.match(line):
RuntimeError: maximum recursion limit exceeded

I went to jython.org to get the 2.7.1b1 you mentioned, and I see nothing there. Googling around, the releases are mentioned on Frank's blog and nowhere else? I'm trying to install it now, but one way to get better Jython support would be to encourage Jython to be less unique in their release choreography.

@nedbat
Copy link
Owner Author

nedbat commented Jan 13, 2017

I've pushed some changes to deal with a missing multiprocessing module. The test suite mostly still doesn't run, so let me know what you find trying to use coverage.py on Jython.

@nedbat
Copy link
Owner Author

nedbat commented Jan 13, 2017

Also, other tips for Jython would be appreciated. For example, I can't run "coverage --version" under Jython because shebang line in the launcher refers to the jython executable, which is really a Python 2.7 script, or something?

@nedbat
Copy link
Owner Author

nedbat commented Jan 13, 2017

Original comment by Chris (Bitbucket: offbyone, GitHub: offbyone)


I have to admit, the thing I most want is for importing it not to blow up on Jython :) If it works, so much the better -- and I'll probably be motivated to look at that in the near-ish future. But for now, "not exploding" is a good start.

Will you release a 4.3.2 to include that?

@nedbat
Copy link
Owner Author

nedbat commented Jan 14, 2017

Fixed as of 4d9c54230ba7 (bb)

@nedbat
Copy link
Owner Author

nedbat commented Jan 16, 2017

Original comment by Chris (Bitbucket: offbyone, GitHub: offbyone)


Ned, is there anything I could do to nudge a 4.3.2 release? I'd love to pull this in and start using it.

@nedbat
Copy link
Owner Author

nedbat commented Jan 17, 2017

Original comment by Chris (Bitbucket: offbyone, GitHub: offbyone)


Thanks!

@nedbat nedbat closed this as completed Jan 17, 2017
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant