diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-12-23 20:17:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-23 20:17:24 (GMT) |
commit | 745545b5bb847023f90505bf9caa983463413780 (patch) | |
tree | 1b6db7fc6c92542ac9bc56769524ee26ce9eb10e /Lib/unittest | |
parent | c5726b727e26b81a267933654cf26b760a90d9aa (diff) | |
download | cpython-745545b5bb847023f90505bf9caa983463413780.zip cpython-745545b5bb847023f90505bf9caa983463413780.tar.gz cpython-745545b5bb847023f90505bf9caa983463413780.tar.bz2 |
gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)
Diffstat (limited to 'Lib/unittest')
-rw-r--r-- | Lib/unittest/loader.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py index eb18cd0..80d4fbd 100644 --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -57,9 +57,7 @@ def _make_skipped_test(methodname, exception, suiteClass): TestClass = type("ModuleSkipped", (case.TestCase,), attrs) return suiteClass((TestClass(methodname),)) -def _jython_aware_splitext(path): - if path.lower().endswith('$py.class'): - return path[:-9] +def _splitext(path): return os.path.splitext(path)[0] @@ -315,7 +313,7 @@ class TestLoader(object): def _get_name_from_path(self, path): if path == self._top_level_dir: return '.' - path = _jython_aware_splitext(os.path.normpath(path)) + path = _splitext(os.path.normpath(path)) _relpath = os.path.relpath(path, self._top_level_dir) assert not os.path.isabs(_relpath), "Path must be within the project" @@ -393,13 +391,13 @@ class TestLoader(object): else: mod_file = os.path.abspath( getattr(module, '__file__', full_path)) - realpath = _jython_aware_splitext( + realpath = _splitext( os.path.realpath(mod_file)) - fullpath_noext = _jython_aware_splitext( + fullpath_noext = _splitext( os.path.realpath(full_path)) if realpath.lower() != fullpath_noext.lower(): module_dir = os.path.dirname(realpath) - mod_name = _jython_aware_splitext( + mod_name = _splitext( os.path.basename(full_path)) expected_dir = os.path.dirname(full_path) msg = ("%r module incorrectly imported from %r. Expected " |