(cls)
| 76 | |
| 77 | @classmethod |
| 78 | def setUpClass(cls): |
| 79 | if cls._has_run: |
| 80 | # Since gh-104798 (Use setuptools in peg-generator and reenable |
| 81 | # tests), this test case has been producing ref leaks. Initial |
| 82 | # debugging points to bug(s) in setuptools and/or importlib. |
| 83 | # See gh-105063 for more info. |
| 84 | raise unittest.SkipTest("gh-105063: can not rerun because of ref. leaks") |
| 85 | cls._has_run = True |
| 86 | |
| 87 | # When running under regtest, a separate tempdir is used |
| 88 | # as the current directory and watched for left-overs. |
| 89 | # Reusing that as the base for temporary directories |
| 90 | # ensures everything is cleaned up properly and |
| 91 | # cleans up afterwards if not (with warnings). |
| 92 | cls.tmp_base = os.getcwd() |
| 93 | if os.path.samefile(cls.tmp_base, os_helper.SAVEDCWD): |
| 94 | cls.tmp_base = None |
| 95 | # Create a directory for the reuseable static library part of |
| 96 | # the pegen extension build process. This greatly reduces the |
| 97 | # runtime overhead of spawning compiler processes. |
| 98 | cls.library_dir = tempfile.mkdtemp(dir=cls.tmp_base) |
| 99 | cls.addClassCleanup(shutil.rmtree, cls.library_dir) |
| 100 | |
| 101 | with contextlib.ExitStack() as stack: |
| 102 | python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools("venv")) |
| 103 | platlib_path = subprocess.check_output( |
| 104 | [python_exe, "-c", "import sysconfig; print(sysconfig.get_path('platlib'))"], |
| 105 | text=True, |
| 106 | ).strip() |
| 107 | purelib_path = subprocess.check_output( |
| 108 | [python_exe, "-c", "import sysconfig; print(sysconfig.get_path('purelib'))"], |
| 109 | text=True, |
| 110 | ).strip() |
| 111 | stack.enter_context(import_helper.DirsOnSysPath(platlib_path, purelib_path)) |
| 112 | cls.addClassCleanup(stack.pop_all().close) |
| 113 | |
| 114 | @support.requires_venv_with_pip() |
| 115 | def setUp(self): |
nothing calls this directly
no test coverage detected