Fix compatibility with pytest master
Fix the autouse fixture which diverts atexit.register calls to support the correct signature.
This commit is contained in:
@@ -22,12 +22,16 @@ def _divert_atexit(request, monkeypatch):
|
|||||||
|
|
||||||
finalizers = []
|
finalizers = []
|
||||||
|
|
||||||
def finish():
|
def fake_register(func, *args, **kwargs):
|
||||||
while finalizers:
|
finalizers.append((func, args, kwargs))
|
||||||
finalizers.pop()()
|
|
||||||
|
|
||||||
monkeypatch.setattr(atexit, "register", finalizers.append)
|
monkeypatch.setattr(atexit, "register", fake_register)
|
||||||
request.addfinalizer(finish)
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
while finalizers:
|
||||||
|
func, args, kwargs = finalizers.pop()
|
||||||
|
func(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|||||||
Reference in New Issue
Block a user