Long ago I have had this rather silly test for my application:
def test_Main_empty_cmdline(commands): with pytest.raises(SystemExit): commands.Main([])