diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py index 2b91bdcf9cd859..edcd2b9a35bbd9 100644 --- a/Lib/test/support/import_helper.py +++ b/Lib/test/support/import_helper.py @@ -58,8 +58,8 @@ def make_legacy_pyc(source): :return: The file system path to the legacy pyc file. """ pyc_file = importlib.util.cache_from_source(source) - assert source.endswith('.py') - legacy_pyc = source + 'c' + up_one = os.path.dirname(os.path.abspath(source)) + legacy_pyc = os.path.join(up_one, source + 'c') shutil.move(pyc_file, legacy_pyc) return legacy_pyc