Skip to content
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

Get program name from command line when invoked as package #600

Closed
nedbat opened this issue Sep 8, 2017 · 3 comments
Closed

Get program name from command line when invoked as package #600

nedbat opened this issue Sep 8, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Sep 8, 2017

Originally reported by Ben Finney (Bitbucket: bignose, GitHub: bignose)


The program name, for use in the help message, is derived from the command-line arguments — except when the command-line shows the program is the main module of a package.

        self.program_name = os.path.basename(sys.argv[0])
        if self.program_name == '__main__.py':
            self.program_name = 'coverage'

The name ‘coverage’ is hard-coded, regardless of what the package actually is.

Instead, when the command-line first argument shows the program was invoked as a package, the package name should be used for the program name.


@nedbat
Copy link
Owner Author

nedbat commented Sep 8, 2017

Original comment by Ben Finney (Bitbucket: bignose, GitHub: bignose)


This patch implements a proposed improvement for this bug.

I am not able to figure out how to get the tests running, so I have written test cases that I hope demonstrate the problem and test the implementation.

@nedbat
Copy link
Owner Author

nedbat commented Oct 19, 2017

Applied in 975306de6b68 (bb) and fixed in 822e09154bb7 (bb). Thanks :)

@nedbat
Copy link
Owner Author

nedbat commented Nov 5, 2017

This has shipped in 4.4.2

@nedbat nedbat closed this as completed Nov 5, 2017
@nedbat nedbat added minor bug Something isn't working labels Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant