painless-software / python-cli-test-helpers

Useful helpers for writing tests for your Python CLI program.
https://python-cli-test-helpers.readthedocs.io
GNU General Public License v3.0
28 stars 4 forks source link

Exercise code in `__main__` module (examples) #31

Closed bittner closed 1 year ago

bittner commented 1 year ago

We can increase code coverage (in our exercises) by importing the __main__ module in a CLI test.

The code that is guarded from being executed during an import (by if __name__ == '__main__':) is not executed this way. To also execute that remains an exercise to the reader, for future iterations.