Skip to content

Commit b25d3c3

Browse files
The-Compilerbluetech
authored andcommitted
testing: make the atexit monkeypatch more robust, needed for pytest 6
1 parent b29c386 commit b25d3c3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

testing/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ def _divert_atexit(request, monkeypatch):
99
import atexit
1010
atexit_fns = []
1111

12+
def atexit_register(func, *args, **kwargs):
13+
atexit_fns.append(lambda: func(*args, **kwargs))
14+
1215
def finish():
1316
while atexit_fns:
1417
atexit_fns.pop()()
1518

16-
monkeypatch.setattr(atexit, "register", atexit_fns.append)
19+
monkeypatch.setattr(atexit, "register", atexit_register)
1720
request.addfinalizer(finish)

0 commit comments

Comments
 (0)