MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_envar_unimportable

Method test_envar_unimportable

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

Source from the content-addressed store, hash-verified

2530
2531 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2532 def test_envar_unimportable(self):
2533 for envar in (
2534 '.', '..', '.foo', 'foo.', '.int', 'int.',
2535 '.foo.bar', '..foo.bar', '/./',
2536 'nosuchbuiltin',
2537 'nosuchmodule.nosuchcallable',
2538 ):
2539 with self.subTest(envar=envar):
2540 self.env['PYTHONBREAKPOINT'] = envar
2541 mock = self.resources.enter_context(patch('pdb.set_trace'))
2542 w = self.resources.enter_context(check_warnings(quiet=True))
2543 breakpoint()
2544 self.assertEqual(
2545 str(w.message),
2546 f'Ignoring unimportable $PYTHONBREAKPOINT: "{envar}"')
2547 self.assertEqual(w.category, RuntimeWarning)
2548 mock.assert_not_called()
2549
2550 def test_envar_ignored_when_hook_is_set(self):
2551 self.env['PYTHONBREAKPOINT'] = 'sys.exit'

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected