2323from testing .fixtures import write_config
2424
2525
26- @pytest .yield_fixture
26+ @pytest .fixture
2727def tempdir_factory (tmpdir ):
2828 class TmpdirFactory (object ):
2929 def __init__ (self ):
@@ -38,7 +38,7 @@ def get(self):
3838 yield TmpdirFactory ()
3939
4040
41- @pytest .yield_fixture
41+ @pytest .fixture
4242def in_tmpdir (tempdir_factory ):
4343 path = tempdir_factory .get ()
4444 with cwd (path ):
@@ -65,7 +65,7 @@ def _make_conflict():
6565 cmd_output ('git' , 'merge' , 'foo' , retcode = None )
6666
6767
68- @pytest .yield_fixture
68+ @pytest .fixture
6969def in_merge_conflict (tempdir_factory ):
7070 path = make_consuming_repo (tempdir_factory , 'script_hooks_repo' )
7171 with cwd (path ):
@@ -80,7 +80,7 @@ def in_merge_conflict(tempdir_factory):
8080 yield os .path .join (conflict_path )
8181
8282
83- @pytest .yield_fixture
83+ @pytest .fixture
8484def in_conflicting_submodule (tempdir_factory ):
8585 git_dir_1 = git_dir (tempdir_factory )
8686 git_dir_2 = git_dir (tempdir_factory )
@@ -116,7 +116,7 @@ def commit_msg_repo(tempdir_factory):
116116 yield path
117117
118118
119- @pytest .yield_fixture (autouse = True , scope = 'session' )
119+ @pytest .fixture (autouse = True , scope = 'session' )
120120def dont_write_to_home_directory ():
121121 """pre_commit.store.Store will by default write to the home directory
122122 We'll mock out `Store.get_default_directory` to raise invariantly so we
@@ -138,7 +138,7 @@ def configure_logging():
138138 add_logging_handler (use_color = False )
139139
140140
141- @pytest .yield_fixture
141+ @pytest .fixture
142142def mock_out_store_directory (tempdir_factory ):
143143 tmpdir = tempdir_factory .get ()
144144 with mock .patch .object (
@@ -149,23 +149,23 @@ def mock_out_store_directory(tempdir_factory):
149149 yield tmpdir
150150
151151
152- @pytest .yield_fixture
152+ @pytest .fixture
153153def store (tempdir_factory ):
154154 yield Store (os .path .join (tempdir_factory .get (), '.pre-commit' ))
155155
156156
157- @pytest .yield_fixture
157+ @pytest .fixture
158158def runner_with_mocked_store (mock_out_store_directory ):
159159 yield Runner ('/' , C .CONFIG_FILE )
160160
161161
162- @pytest .yield_fixture
162+ @pytest .fixture
163163def log_info_mock ():
164164 with mock .patch .object (logging .getLogger ('pre_commit' ), 'info' ) as mck :
165165 yield mck
166166
167167
168- @pytest .yield_fixture
168+ @pytest .fixture
169169def log_warning_mock ():
170170 with mock .patch .object (logging .getLogger ('pre_commit' ), 'warning' ) as mck :
171171 yield mck
@@ -197,7 +197,7 @@ def get(self):
197197 return self .get_bytes ().decode ('UTF-8' )
198198
199199
200- @pytest .yield_fixture
200+ @pytest .fixture
201201def cap_out ():
202202 stream = FakeStream ()
203203 write = functools .partial (output .write , stream = stream )
@@ -207,7 +207,7 @@ def cap_out():
207207 yield Fixture (stream )
208208
209209
210- @pytest .yield_fixture
210+ @pytest .fixture
211211def fake_log_handler ():
212212 handler = mock .Mock (level = logging .INFO )
213213 logger = logging .getLogger ('pre_commit' )
0 commit comments