Checks some key parts of the C-API that need to work before the runtime is initialized (via Py_Initialize()).
(self)
| 314 | self.assertEqual(out.strip(), expected_output) |
| 315 | |
| 316 | def test_pre_initialization_api(self): |
| 317 | """ |
| 318 | Checks some key parts of the C-API that need to work before the runtime |
| 319 | is initialized (via Py_Initialize()). |
| 320 | """ |
| 321 | env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path)) |
| 322 | out, err = self.run_embedded_interpreter("test_pre_initialization_api", env=env) |
| 323 | if support.verbose > 1: |
| 324 | print() |
| 325 | print(out) |
| 326 | print(err) |
| 327 | if MS_WINDOWS: |
| 328 | expected_path = self.test_exe |
| 329 | else: |
| 330 | expected_path = os.path.join(os.getcwd(), "_testembed") |
| 331 | expected_output = f"sys.executable: {expected_path}\n" |
| 332 | self.assertIn(expected_output, out) |
| 333 | self.assertEqual(err, '') |
| 334 | |
| 335 | def test_pre_initialization_sys_options(self): |
| 336 | """ |
nothing calls this directly
no test coverage detected