Skip to content

Instantly share code, notes, and snippets.

@petri
Created November 27, 2020 20:56
Show Gist options
  • Save petri/52103a83f9ba31682898e9498f4e9da6 to your computer and use it in GitHub Desktop.
Save petri/52103a83f9ba31682898e9498f4e9da6 to your computer and use it in GitHub Desktop.
test example
def test_cmdline_logging_info(caplog, capsys):
retv = tnefparse.cmdline.tnefparse(('-l', 'INFO', '-rb', 'tests/examples/rtf.tnef'))
assert not retv
stdout, _ = capsys.readouterr()
assert len(stdout) == 593
assert caplog.record_tuples == [
('tnefparse', logging.INFO, 'Skipping checksum for performance'),
]
def tnefparse(argv=None):
"command-line script"
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args(argv)
if args.logging:
logger.setLevel(getattr(logging, args.logging))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment