Cannot use coverage with jython

Issue #322 resolved
Chris Bannan created an issue

Using the windows installer, there is no coveragepy directory created. Therefore python COVERAGEDIR cannot be used

But, using the bitbucket clone, that directory is created

To use coverage with python, one can run python -m coverage run There is no equivalent for jython.

However, jython \coveragepy\ run does work This seems like it is not what you intended.

Also, jython \coveragepy\ html fails. The error is attached.

My environment is

  •, version 3.7.1

  • Python 2.7

  • Jython 2.7b2

  • java version "1.7.0_65" Java(TM) SE Runtime Environment (build 1.7.0_65-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

Comments (11)

  1. Ned Batchelder repo owner

    I'm not sure what "python COVERAGEDIR" means: where did that come from? Generally, the problem here is that you have to get coverage installed into your Jython installation. The windows installer won't know about Jython, so you'll need to do it more manually: untar the source tarball, and use "jython install".

    The HTML issue is known, I should document that.

  2. Chris Bannan reporter

    Sorry about the incomplete COVERAGEDIR comment. That is from the Jython coverage instructions. See section 6.2.1 at

    There is a work-around for jython. It is in the original bug report. However, It seems wrong. Relying on that seems foolish as it seems like an undocumented or possibly unsupported feature.

  3. Ned Batchelder repo owner

    @cmbannan Sorry I've taken so long to get back to this. I'd like to get back to testing under Jython, so I'm trying to reproduce these problems now. If you have any more information, I'd be grateful.

  4. Loic Dachary

    I tried to reproduce the problem with jython-2.5.3 on Ubuntu 16.04 but got the following error

    $ jython run 
    jython run 
    "my" variable $jythonHome masks earlier declaration in same scope at /usr/bin/jython line 15.
    Traceback (most recent call last):
      File "", line 11, in <module>
        run_globals = runpy.run_module(PKG, run_name='__main__', alter_sys=True)
      File "", line 11, in <module>
        run_globals = runpy.run_module(PKG, run_name='__main__', alter_sys=True)
      File "/usr/share/jython/Lib/", line 94, in run_module
        return _run_module_code(code, init_globals, run_name,
      File "/usr/share/jython/Lib/", line 51, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/share/jython/Lib/", line 32, in _run_code
        exec code in run_globals
      File "/tmp/f/", line 11, in <module>
        from coverage.version import __version__, __url__, version_info
      File "/tmp/f/", line 13, in <module>
        from coverage.control import Coverage, process_startup
      File "/tmp/f/", line 339
    SyntaxError: 'with' will become a reserved keyword in Python 2.6
  5. Ned Batchelder repo owner

    Also, #551 reports Jython problems that I am trying to fix. More Jython info is definitely appreciated.

  6. Log in to comment