(self, libpath: str, *, import_site: bool)
| 695 | return sys_path |
| 696 | |
| 697 | def _get_pth_lines(self, libpath: str, *, import_site: bool): |
| 698 | pth_lines = ['fake-path-name'] |
| 699 | # include 200 lines of `libpath` in _pth lines (or fewer |
| 700 | # if the `libpath` is long enough to get close to 32KB |
| 701 | # see https://github.com/python/cpython/issues/113628) |
| 702 | encoded_libpath_length = len(libpath.encode("utf-8")) |
| 703 | repetitions = min(200, 30000 // encoded_libpath_length) |
| 704 | if repetitions <= 2: |
| 705 | self.skipTest( |
| 706 | f"Python stdlib path is too long ({encoded_libpath_length:,} bytes)") |
| 707 | pth_lines.extend(libpath for _ in range(repetitions)) |
| 708 | pth_lines.extend(['', '# comment']) |
| 709 | if import_site: |
| 710 | pth_lines.append('import site') |
| 711 | return pth_lines |
| 712 | |
| 713 | @support.requires_subprocess() |
| 714 | def test_underpth_basic(self): |
no test coverage detected