File tree 3 files changed +8
-13
lines changed 3 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ Janne Vanhala
71
71
Jason R. Coombs
72
72
Javier Domingo Cansino
73
73
Javier Romero
74
+ Jeff Widman
74
75
John Towler
75
76
Jon Sonesen
76
77
Jordan Guymon
Original file line number Diff line number Diff line change 11
11
12
12
13
13
@pytest .fixture
14
- def monkeypatch (request ):
14
+ def monkeypatch ():
15
15
"""The returned ``monkeypatch`` fixture provides these
16
16
helper methods to modify objects, dictionaries or os.environ::
17
17
@@ -30,8 +30,8 @@ def monkeypatch(request):
30
30
will be raised if the set/deletion operation has no target.
31
31
"""
32
32
mpatch = MonkeyPatch ()
33
- request . addfinalizer ( mpatch . undo )
34
- return mpatch
33
+ yield mpatch
34
+ mpatch . undo ()
35
35
36
36
37
37
def resolve (name ):
Original file line number Diff line number Diff line change 7
7
8
8
9
9
@pytest .fixture
10
- def mp (request ):
10
+ def mp ():
11
11
cwd = os .getcwd ()
12
12
sys_path = list (sys .path )
13
-
14
- def cleanup ():
15
- sys .path [:] = sys_path
16
- os .chdir (cwd )
17
-
18
- request .addfinalizer (cleanup )
19
- return MonkeyPatch ()
13
+ yield MonkeyPatch ()
14
+ sys .path [:] = sys_path
15
+ os .chdir (cwd )
20
16
21
17
22
18
def test_setattr ():
@@ -329,5 +325,3 @@ def test_issue1338_name_resolving():
329
325
monkeypatch .delattr ('requests.sessions.Session.request' )
330
326
finally :
331
327
monkeypatch .undo ()
332
-
333
-
You can’t perform that action at this time.
0 commit comments