Skip to content

Commit

Permalink
audit-tests: Pass argv to the test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou committed Aug 23, 2023
1 parent 75b75a5 commit d8e1891
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Lib/test/audit-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class C(A):
)


def test_open():
def test_open(testfn):
# SSLContext.load_dh_params uses _Py_fopen_obj rather than normal open()
try:
import ssl
Expand All @@ -199,11 +199,11 @@ def test_open():
# All of them should fail
with TestHook(raise_on_events={"open"}) as hook:
for fn, *args in [
(open, sys.argv[2], "r"),
(open, testfn, "r"),
(open, sys.executable, "rb"),
(open, 3, "wb"),
(open, sys.argv[2], "w", -1, None, None, None, False, lambda *a: 1),
(load_dh_params, sys.argv[2]),
(open, testfn, "w", -1, None, None, None, False, lambda *a: 1),
(load_dh_params, testfn),
]:
if not fn:
continue
Expand All @@ -216,11 +216,11 @@ def test_open():
[
i
for i in [
(sys.argv[2], "r"),
(testfn, "r"),
(sys.executable, "r"),
(3, "w"),
(sys.argv[2], "w"),
(sys.argv[2], "rb") if load_dh_params else None,
(testfn, "w"),
(testfn, "rb") if load_dh_params else None,
]
if i is not None
],
Expand Down Expand Up @@ -550,4 +550,4 @@ def hook(event, args):
suppress_msvcrt_asserts()

test = sys.argv[1]
globals()[test]()
globals()[test](*sys.argv[2:])

0 comments on commit d8e1891

Please sign in to comment.