Skip to content

gh-131178: Add tests for profile module command-line interface - #158542

Draft
Nityahapani wants to merge 1 commit into
python:mainfrom
Nityahapani:fix-gh-131178-profile-cli-tests
Draft

Nityahapani wants to merge 1 commit into
python:mainfrom
Nityahapani:fix-gh-131178-profile-cli-tests

Conversation

@Nityahapani

@Nityahapani Nityahapani commented Oct 1, 2026 •

Copy link
Copy Markdown

Add a new ProfileCLITest class to Lib/test/test_profile.py with tests covering the full CLI surface of the profile module:

  • No arguments prints usage and exits with code 2
  • -h/--help prints usage and exits with code 0
  • Profiling a script file directly
  • -m flag to profile a library module
  • -m flag with a non-existent module (failure case)
  • -o/--outfile writes a valid pstats file
  • -s/--sort accepts a sort key without error
  • -m alone without a module name (failure case)

Add a new `ProfileCLITest` class to `Lib/test/test_profile.py` with
tests covering the full CLI surface of the `profile` module:

- No arguments prints usage and exits with code 2
- `-h`/`--help` prints usage and exits with code 0
- Profiling a script file directly
- `-m` flag to profile a library module
- `-m` flag with a non-existent module (failure case)
- `-o`/`--outfile` writes a valid pstats file
- `-s`/`--sort` accepts a sort key without error
- `-m` alone without a module name (failure case)

Co-authored-by: Nityahapani <nityah@users.noreply.github.com>
@python-cla-bot

python-cla-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 1, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 1, 2026
7 of 9 tasks
@bedevere-app bedevere-app Bot added awaiting review tests Tests in the Lib/test dir labels Oct 1, 2026

@BHUVANSH855 BHUVANSH855 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sign CLA, so that maintainers can begin with review process.

@picnixz picnixz removed the type-feature A feature request or enhancement label Oct 1, 2026
@StanFromIreland
StanFromIreland marked this pull request as draft October 1, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants