Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-102541: Add test case for help() for non_existent_module #106340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Lib/test/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from urllib.request import urlopen, urlcleanup
from test.support import import_helper
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support.script_helper import (assert_python_ok,
assert_python_failure, spawn_python)
from test.support import threading_helper
from test.support import (reap_children, captured_output, captured_stdout,
captured_stderr, is_emscripten, is_wasi,
Expand Down Expand Up @@ -631,6 +632,14 @@ def test_builtin_on_metaclasses(self):
# Testing that the subclasses section does not appear
self.assertNotIn('Built-in subclasses', text)

def test_fail_help_cli(self):
elines = (missing_pattern % 'abd').splitlines()
with spawn_python("-c" "help()") as proc:
out, _ = proc.communicate(b"abd")
olines = out.decode().splitlines()[-9:-6]
olines[0] = olines[0].removeprefix('help> ')
self.assertEqual(elines, olines)

def test_fail_help_output_redirect(self):
with StringIO() as buf:
helper = pydoc.Helper(output=buf)
Expand Down