Skip to content

gh-154007: Improve test coverage for the shlex module#154009

Open
caseneuve wants to merge 1 commit into
python:mainfrom
caseneuve:154007-improve-shlex-test-coverage
Open

gh-154007: Improve test coverage for the shlex module#154009
caseneuve wants to merge 1 commit into
python:mainfrom
caseneuve:154007-improve-shlex-test-coverage

Conversation

@caseneuve

@caseneuve caseneuve commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Raises statement coverage of Lib/shlex.py from 67% to 91%.

Intentionally left out:

  • _print_tokens: only reachable via python -m shlex, not public API
  • A few break/continue branches deep in read_token()

Closes #154007.

Comment thread Lib/test/test_shlex.py
Comment thread Lib/test/test_shlex.py Outdated
Comment thread Lib/test/test_shlex.py Outdated
Comment thread Lib/test/test_shlex.py Outdated
Comment thread Lib/test/test_shlex.py Outdated
@caseneuve
caseneuve force-pushed the 154007-improve-shlex-test-coverage branch from 8afc311 to cf4df39 Compare July 19, 2026 11:00
@caseneuve
caseneuve requested a review from tomasr8 July 19, 2026 11:00
@caseneuve
caseneuve force-pushed the 154007-improve-shlex-test-coverage branch from cf4df39 to 8fa77b3 Compare July 19, 2026 11:03
@caseneuve
caseneuve force-pushed the 154007-improve-shlex-test-coverage branch from 8fa77b3 to 9b33e5c Compare July 19, 2026 11:12
Comment thread Lib/test/test_shlex.py
Comment on lines +528 to +529
s = shlex.shlex(" a")
s.debug = 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can also go outside the context manager (same for the other 3 test cases below)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Improve test coverage for the shlex module

2 participants