MCPcopy
hub / github.com/django/django / test_python

Method test_python

tests/shell/tests.py:190–201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

188 call_command("shell", interface="bpython")
189
190 def test_python(self):
191 cmd = shell.Command()
192 mock_code = mock.Mock(interact=mock.MagicMock())
193 options = {"verbosity": 0, "no_startup": True, "no_imports": False}
194
195 with mock.patch.dict(sys.modules, {"code": mock_code}):
196 cmd.python(options)
197
198 self.assertEqual(
199 mock_code.interact.mock_calls,
200 [mock.call(local=cmd.get_namespace(**options))],
201 )
202
203 # [1] Patch select to prevent tests failing when the test suite is run
204 # in parallel mode. The tests are run in a subprocess and the subprocess's

Callers

nothing calls this directly

Calls 4

pythonMethod · 0.95
get_namespaceMethod · 0.95
dictMethod · 0.80
callMethod · 0.80

Tested by

no test coverage detected