11# -*- coding: utf-8 -*-
22import pytest
33
4- from mock import Mock , patch , call
4+ from unittest . mock import Mock , patch , call
55
66from sqlalchemydiff .comparer import (
77 _compile_errors ,
3535from test import assert_items_equal
3636
3737
38- @pytest .yield_fixture
38+ @pytest .fixture
3939def mock_inspector_factory ():
4040 with patch .object (InspectorFactory , 'from_uri' ) as from_uri :
4141 from_uri .side_effect = [
@@ -50,7 +50,7 @@ class TestCompareCallsChain(object):
5050 """This test class makes sure the `compare` function inside process
5151 works as expected.
5252 """
53- @pytest .yield_fixture
53+ @pytest .fixture
5454 def _get_inspectors_mock (self ):
5555 with patch ('sqlalchemydiff.comparer._get_inspectors' ) as m :
5656 m .return_value = [
@@ -59,12 +59,12 @@ def _get_inspectors_mock(self):
5959 ]
6060 yield m
6161
62- @pytest .yield_fixture
62+ @pytest .fixture
6363 def _get_tables_data_mock (self ):
6464 with patch ('sqlalchemydiff.comparer._get_tables_data' ) as m :
6565 yield m
6666
67- @pytest .yield_fixture
67+ @pytest .fixture
6868 def _compile_errors_mock (self ):
6969 with patch ('sqlalchemydiff.comparer._compile_errors' ) as m :
7070
@@ -81,7 +81,7 @@ def info_side_effect(info):
8181 m .side_effect = info_side_effect
8282 yield m
8383
84- @pytest .yield_fixture
84+ @pytest .fixture
8585 def _get_tables_info_mock (self ):
8686 with patch ('sqlalchemydiff.comparer._get_tables_info' ) as m :
8787 m .return_value = TablesInfo (
@@ -93,7 +93,7 @@ def _get_tables_info_mock(self):
9393 )
9494 yield m
9595
96- @pytest .yield_fixture
96+ @pytest .fixture
9797 def _get_enums_data_mock (self ):
9898 with patch ('sqlalchemydiff.comparer._get_enums_data' ) as m :
9999 m .return_value = []
@@ -172,67 +172,67 @@ class TestCompareInternals(object):
172172
173173 # FIXTURES
174174
175- @pytest .yield_fixture
175+ @pytest .fixture
176176 def _get_table_data_mock (self ):
177177 with patch ('sqlalchemydiff.comparer._get_table_data' ) as m :
178178 yield m
179179
180- @pytest .yield_fixture
180+ @pytest .fixture
181181 def _diff_dicts_mock (self ):
182182 with patch ('sqlalchemydiff.comparer._diff_dicts' ) as m :
183183 yield m
184184
185- @pytest .yield_fixture
185+ @pytest .fixture
186186 def _get_foreign_keys_mock (self ):
187187 with patch ('sqlalchemydiff.comparer._get_foreign_keys' ) as m :
188188 yield m
189189
190- @pytest .yield_fixture
190+ @pytest .fixture
191191 def _get_primary_keys_mock (self ):
192192 with patch ('sqlalchemydiff.comparer._get_primary_keys' ) as m :
193193 yield m
194194
195- @pytest .yield_fixture
195+ @pytest .fixture
196196 def _get_indexes_mock (self ):
197197 with patch ('sqlalchemydiff.comparer._get_indexes' ) as m :
198198 yield m
199199
200- @pytest .yield_fixture
200+ @pytest .fixture
201201 def _get_columns_mock (self ):
202202 with patch ('sqlalchemydiff.comparer._get_columns' ) as m :
203203 yield m
204204
205- @pytest .yield_fixture
205+ @pytest .fixture
206206 def _process_types_mock (self ):
207207 with patch ('sqlalchemydiff.comparer._process_types' ) as m :
208208 yield m
209209
210- @pytest .yield_fixture
210+ @pytest .fixture
211211 def _process_type_mock (self ):
212212 with patch ('sqlalchemydiff.comparer._process_type' ) as m :
213213 yield m
214214
215- @pytest .yield_fixture
215+ @pytest .fixture
216216 def _get_foreign_keys_info_mock (self ):
217217 with patch ('sqlalchemydiff.comparer._get_foreign_keys_info' ) as m :
218218 yield m
219219
220- @pytest .yield_fixture
220+ @pytest .fixture
221221 def _get_primary_keys_info_mock (self ):
222222 with patch ('sqlalchemydiff.comparer._get_primary_keys_info' ) as m :
223223 yield m
224224
225- @pytest .yield_fixture
225+ @pytest .fixture
226226 def _get_indexes_info_mock (self ):
227227 with patch ('sqlalchemydiff.comparer._get_indexes_info' ) as m :
228228 yield m
229229
230- @pytest .yield_fixture
230+ @pytest .fixture
231231 def _get_columns_info_mock (self ):
232232 with patch ('sqlalchemydiff.comparer._get_columns_info' ) as m :
233233 yield m
234234
235- @pytest .yield_fixture
235+ @pytest .fixture
236236 def _get_constraints_info_mock (self ):
237237 with patch ('sqlalchemydiff.comparer._get_constraints_info' ) as m :
238238 yield m
0 commit comments