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

Method test_envar_unimportable

Lib/test/test_builtin.py:2581–2597  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2579
2580 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2581 def test_envar_unimportable(self):
2582 for envar in (
2583 '.', '..', '.foo', 'foo.', '.int', 'int.',
2584 '.foo.bar', '..foo.bar', '/./',
2585 'nosuchbuiltin',
2586 'nosuchmodule.nosuchcallable',
2587 ):
2588 with self.subTest(envar=envar):
2589 self.env['PYTHONBREAKPOINT'] = envar
2590 mock = self.resources.enter_context(patch('pdb.set_trace'))
2591 w = self.resources.enter_context(check_warnings(quiet=True))
2592 breakpoint()
2593 self.assertEqual(
2594 str(w.message),
2595 f'Ignoring unimportable $PYTHONBREAKPOINT: "{envar}"')
2596 self.assertEqual(w.category, RuntimeWarning)
2597 mock.assert_not_called()
2598
2599 def test_envar_ignored_when_hook_is_set(self):
2600 self.env['PYTHONBREAKPOINT'] = 'sys.exit'

Callers

nothing calls this directly

Calls 7

patchFunction · 0.90
check_warningsFunction · 0.90
strFunction · 0.85
enter_contextMethod · 0.80
assert_not_calledMethod · 0.80
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected