MCPcopy Index your code
hub / github.com/python/cpython / test_pre_initialization_sys_options

Method test_pre_initialization_sys_options

Lib/test/test_embed.py:335–354  ·  view source on GitHub ↗

Checks that sys.warnoptions and sys._xoptions can be set before the runtime is initialized (otherwise they won't be effective).

(self)

Source from the content-addressed store, hash-verified

333 self.assertEqual(err, '')
334
335 def test_pre_initialization_sys_options(self):
336 """
337 Checks that sys.warnoptions and sys._xoptions can be set before the
338 runtime is initialized (otherwise they won't be effective).
339 """
340 env = remove_python_envvars()
341 env['PYTHONPATH'] = os.pathsep.join(sys.path)
342 out, err = self.run_embedded_interpreter(
343 "test_pre_initialization_sys_options", env=env)
344 if support.verbose > 1:
345 print()
346 print(out)
347 print(err)
348 expected_output = (
349 "sys.warnoptions: ['once', 'module', 'default']\n"
350 "sys._xoptions: {'not_an_option': '1', 'also_not_an_option': '2'}\n"
351 "warnings.filters[:3]: ['default', 'module', 'once']\n"
352 )
353 self.assertIn(expected_output, out)
354 self.assertEqual(err, '')
355
356 def test_bpo20891(self):
357 """

Callers

nothing calls this directly

Calls 5

remove_python_envvarsFunction · 0.85
assertInMethod · 0.80
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected