8000 gh-131178: Add tests for `pickle` command-line interface by donBarbos · Pull Request #131275 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131178: Add tests for pickle command-line interface #131275

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 8 commits into from
Apr 6, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add suggestions
  • Loading branch information
donBarbos committed Mar 31, 2025
commit 685691810d828cc7e196887207c7e15cd8c62413
13 changes: 5 additions & 8 deletions Lib/test/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import tempfile
import warnings
import weakref
from textwrap import dedent

import doctest
import unittest
from textwrap import dedent
from test import support
from test.support import import_helper, os_helper

Expand Down Expand Up @@ -746,15 +746,12 @@ def test_invocation(self):
self.assertListEqual(res.splitlines(), expect.splitlines())

def test_unknown_flag(self):
output = io.StringIO()
stderr = io.StringIO()
with self.assertRaises(SystemExit):
# suppress argparse error message
with contextlib.redirect_stderr(output):
# check that the parser help is shown
with contextlib.redirect_stderr(stderr):
_ = self.invoke_pickle('--unknown')
msg = output.getvalue()
self.assertTrue(msg.startswith('usage: '),
"Output does not start with 'usage: '. "
f"Output was: {msg}")
self.assertStartsWith(stderr.getvalue(), 'usage: ')


def load_tests(loader, tests, pattern):
Expand Down
Loading
0