File size: 476 Bytes
065fee7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import subprocess
import sys
import pytest
argv_manipulations = [
'del sys.argv',
'sys.argv = []',
'sys.argv = None',
]
@pytest.mark.parametrize('argv', argv_manipulations)
def test_argv(argv):
"""
Keyrings should initialize without error even
when sys.argv is malformed. Ref #445.
"""
code = f'import sys; {argv}; import keyring'
cmd = [sys.executable, '-c', code]
assert not subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|