diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-12-30 18:07:36 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-12-30 18:35:09 -0500 |
commit | 45787e29dea3a41f2e9570b66a571a7ebcda4592 (patch) | |
tree | 7eeadde7d7a033e27abd1df7411bb525bd711148 /coverage | |
parent | 85c7a4ac4161c4eb2efeaf07e6f833d3a073b018 (diff) | |
download | python-coveragepy-git-45787e29dea3a41f2e9570b66a571a7ebcda4592.tar.gz |
refactor: removed mentions of Jython and IronPython
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/control.py | 11 | ||||
-rw-r--r-- | coverage/env.py | 2 | ||||
-rw-r--r-- | coverage/exceptions.py | 10 | ||||
-rw-r--r-- | coverage/inorout.py | 8 | ||||
-rw-r--r-- | coverage/parser.py | 11 | ||||
-rw-r--r-- | coverage/python.py | 8 |
6 files changed, 2 insertions, 48 deletions
diff --git a/coverage/control.py b/coverage/control.py index 71b56a44..6bbc17c7 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -37,6 +37,7 @@ from coverage.jsonreport import JsonReporter from coverage.lcovreport import LcovReporter from coverage.misc import bool_or_none, join_regex, human_sorted from coverage.misc import DefaultValue, ensure_dir_for_file, isolate_module +from coverage.multiproc import patch_multiprocessing from coverage.plugin import FileReporter from coverage.plugin_support import Plugins from coverage.python import PythonFileReporter @@ -46,12 +47,6 @@ from coverage.summary import SummaryReporter from coverage.types import TConfigurable, TConfigSection, TConfigValue, TSysInfo from coverage.xmlreport import XmlReporter -try: - from coverage.multiproc import patch_multiprocessing - has_patch_multiprocessing = True -except ImportError: # pragma: only jython - # Jython has no multiprocessing module. - has_patch_multiprocessing = False os = isolate_module(os) @@ -493,10 +488,6 @@ class Coverage(TConfigurable): # Construct the collector. concurrency: List[str] = self.config.concurrency or [] if "multiprocessing" in concurrency: - if not has_patch_multiprocessing: - raise ConfigError( # pragma: only jython - "multiprocessing is not supported on this Python" - ) if self.config.config_file is None: raise ConfigError("multiprocessing requires a configuration file") patch_multiprocessing(rcfile=self.config.config_file) diff --git a/coverage/env.py b/coverage/env.py index 3d0114c8..fcd5ff04 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -15,8 +15,6 @@ OSX = sys.platform == "darwin" # Python implementations. CPYTHON = (platform.python_implementation() == "CPython") PYPY = (platform.python_implementation() == "PyPy") -JYTHON = (platform.python_implementation() == "Jython") -IRONPYTHON = (platform.python_implementation() == "IronPython") # Python versions. We amend version_info with one more value, a zero if an # official version, or 1 if built from source beyond an official version. diff --git a/coverage/exceptions.py b/coverage/exceptions.py index c6a7f3da..43dc0047 100644 --- a/coverage/exceptions.py +++ b/coverage/exceptions.py @@ -57,16 +57,6 @@ class _ExceptionDuringRun(CoverageException): pass -class _StopEverything(_BaseCoverageException): - """An exception that means everything should stop. - - The CoverageTest class converts these to SkipTest, so that when running - tests, raising this exception will automatically skip the test. - - """ - pass - - class CoverageWarning(Warning): """A warning from Coverage.py.""" pass diff --git a/coverage/inorout.py b/coverage/inorout.py index 65aec83c..4be4a85d 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -81,10 +81,6 @@ def name_for_module(filename: str, frame: Optional[FrameType]) -> str: """ module_globals = frame.f_globals if frame is not None else {} - if module_globals is None: # pragma: only ironpython - # IronPython doesn't provide globals: https://github.com/IronLanguages/main/issues/1296 - module_globals = {} # type: ignore[unreachable] - dunder_name: str = module_globals.get('__name__', None) if isinstance(dunder_name, str) and dunder_name != '__main__': @@ -349,10 +345,6 @@ class InOrOut: # can't do anything with the data later anyway. return nope(disp, "not a real file name") - # Jython reports the .class file to the tracer, use the source file. - if filename.endswith("$py.class"): - filename = filename[:-9] + ".py" - canonical = canonical_filename(filename) disp.canonical_filename = canonical diff --git a/coverage/parser.py b/coverage/parser.py index 9c71e2d3..3512fdc3 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -21,7 +21,7 @@ from typing import ( from coverage import env from coverage.bytecode import code_objects from coverage.debug import short_stack -from coverage.exceptions import NoSource, NotPython, _StopEverything +from coverage.exceptions import NoSource, NotPython from coverage.misc import join_regex, nice_pair from coverage.phystokens import generate_tokens from coverage.types import Protocol, TArc, TLineNo @@ -393,15 +393,6 @@ class ByteParser: ) ) from synerr - # Alternative Python implementations don't always provide all the - # attributes on code objects that we need to do the analysis. - for attr in ['co_lnotab', 'co_firstlineno']: - if not hasattr(self.code, attr): - raise _StopEverything( # pragma: only jython - "This implementation of Python doesn't support code analysis.\n" + - "Run coverage.py under another Python for this command." - ) - def child_parsers(self) -> Iterable[ByteParser]: """Iterate over all the code objects nested within this one. diff --git a/coverage/python.py b/coverage/python.py index 70d38fe3..2d2faa14 100644 --- a/coverage/python.py +++ b/coverage/python.py @@ -35,10 +35,6 @@ def read_python_source(filename: str) -> bytes: with open(filename, "rb") as f: source = f.read() - if env.IRONPYTHON: - # IronPython reads Unicode strings even for "rb" files. - source = bytes(source) - return source.replace(b"\r\n", b"\n").replace(b"\r", b"\n") @@ -126,10 +122,6 @@ def source_for_file(filename: str) -> str: # Didn't find source, but it's probably the .py file we want. return py_filename - elif filename.endswith("$py.class"): - # Jython is easy to guess. - return filename[:-9] + ".py" - # No idea, just use the file name as-is. return filename |