From 2167d74b1a4fc4da0a11c34e170099292aec5f5f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 22 Aug 2020 09:02:41 -0400 Subject: [PATCH] Add test capturing expectation that sys.argv need not be initialized as indicated by the Python docs and might in fact be empty or uninitialized or not a list. Ref #445. --- tests/test_integration.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_integration.py diff --git a/tests/test_integration.py b/tests/test_integration.py new file mode 100644 index 00000000..ecedba55 --- /dev/null +++ b/tests/test_integration.py @@ -0,0 +1,19 @@ +import sys +import subprocess + +import pytest + + +argv_manipulations = [ + 'del sys.argv', + 'sys.argv = []', + 'sys.argv = None', +] + + +@pytest.mark.xfail(reason="#445") +@pytest.mark.parametrize('argv', argv_manipulations) +def test_argv(argv): + code = f'import sys; {argv}; import keyring' + cmd = [sys.executable, '-c', code] + assert not subprocess.check_output(cmd, stderr=subprocess.STDOUT)