|
24 | 24 | from urllib.request import urlopen, urlcleanup |
25 | 25 | from test.support import import_helper |
26 | 26 | from test.support import os_helper |
27 | | -from test.support.script_helper import assert_python_ok, assert_python_failure |
| 27 | +from test.support.script_helper import (assert_python_ok, kill_python, |
| 28 | + assert_python_failure, spawn_python) |
| 29 | + |
28 | 30 | from test.support import threading_helper |
29 | 31 | from test.support import (reap_children, captured_output, captured_stdout, |
30 | 32 | captured_stderr, is_emscripten, is_wasi, |
@@ -631,6 +633,17 @@ def test_builtin_on_metaclasses(self): |
631 | 633 | # Testing that the subclasses section does not appear |
632 | 634 | self.assertNotIn('Built-in subclasses', text) |
633 | 635 |
|
| 636 | + def test_fail_help_cli(self): |
| 637 | + fd, name = tempfile.mkstemp() |
| 638 | + self.addCleanup(os_helper.unlink, name) |
| 639 | + with open(fd, "w") as f: |
| 640 | + f.write("help('abd')") |
| 641 | + with spawn_python(name) as proc: |
| 642 | + out, _ = proc.communicate() |
| 643 | + out = out.decode() |
| 644 | + expected = missing_pattern % "abd" |
| 645 | + self.assertEqual(expected, out.strip()) |
| 646 | + |
634 | 647 | def test_fail_help_output_redirect(self): |
635 | 648 | with StringIO() as buf: |
636 | 649 | helper = pydoc.Helper(output=buf) |
|
0 commit comments