1
1
# -*- coding: utf-8 -*-
2
2
import pytest
3
3
4
- from mock import Mock , patch , call
4
+ from unittest . mock import Mock , patch , call
5
5
6
6
from sqlalchemydiff .comparer import (
7
7
_compile_errors ,
35
35
from test import assert_items_equal
36
36
37
37
38
- @pytest .yield_fixture
38
+ @pytest .fixture
39
39
def mock_inspector_factory ():
40
40
with patch .object (InspectorFactory , 'from_uri' ) as from_uri :
41
41
from_uri .side_effect = [
@@ -50,7 +50,7 @@ class TestCompareCallsChain(object):
50
50
"""This test class makes sure the `compare` function inside process
51
51
works as expected.
52
52
"""
53
- @pytest .yield_fixture
53
+ @pytest .fixture
54
54
def _get_inspectors_mock (self ):
55
55
with patch ('sqlalchemydiff.comparer._get_inspectors' ) as m :
56
56
m .return_value = [
@@ -59,12 +59,12 @@ def _get_inspectors_mock(self):
59
59
]
60
60
yield m
61
61
62
- @pytest .yield_fixture
62
+ @pytest .fixture
63
63
def _get_tables_data_mock (self ):
64
64
with patch ('sqlalchemydiff.comparer._get_tables_data' ) as m :
65
65
yield m
66
66
67
- @pytest .yield_fixture
67
+ @pytest .fixture
68
68
def _compile_errors_mock (self ):
69
69
with patch ('sqlalchemydiff.comparer._compile_errors' ) as m :
70
70
@@ -81,7 +81,7 @@ def info_side_effect(info):
81
81
m .side_effect = info_side_effect
82
82
yield m
83
83
84
- @pytest .yield_fixture
84
+ @pytest .fixture
85
85
def _get_tables_info_mock (self ):
86
86
with patch ('sqlalchemydiff.comparer._get_tables_info' ) as m :
87
87
m .return_value = TablesInfo (
@@ -93,7 +93,7 @@ def _get_tables_info_mock(self):
93
93
)
94
94
yield m
95
95
96
- @pytest .yield_fixture
96
+ @pytest .fixture
97
97
def _get_enums_data_mock (self ):
98
98
with patch ('sqlalchemydiff.comparer._get_enums_data' ) as m :
99
99
m .return_value = []
@@ -172,67 +172,67 @@ class TestCompareInternals(object):
172
172
173
173
# FIXTURES
174
174
175
- @pytest .yield_fixture
175
+ @pytest .fixture
176
176
def _get_table_data_mock (self ):
177
177
with patch ('sqlalchemydiff.comparer._get_table_data' ) as m :
178
178
yield m
179
179
180
- @pytest .yield_fixture
180
+ @pytest .fixture
181
181
def _diff_dicts_mock (self ):
182
182
with patch ('sqlalchemydiff.comparer._diff_dicts' ) as m :
183
183
yield m
184
184
185
- @pytest .yield_fixture
185
+ @pytest .fixture
186
186
def _get_foreign_keys_mock (self ):
187
187
with patch ('sqlalchemydiff.comparer._get_foreign_keys' ) as m :
188
188
yield m
189
189
190
- @pytest .yield_fixture
190
+ @pytest .fixture
191
191
def _get_primary_keys_mock (self ):
192
192
with patch ('sqlalchemydiff.comparer._get_primary_keys' ) as m :
193
193
yield m
194
194
195
- @pytest .yield_fixture
195
+ @pytest .fixture
196
196
def _get_indexes_mock (self ):
197
197
with patch ('sqlalchemydiff.comparer._get_indexes' ) as m :
198
198
yield m
199
199
200
- @pytest .yield_fixture
200
+ @pytest .fixture
201
201
def _get_columns_mock (self ):
202
202
with patch ('sqlalchemydiff.comparer._get_columns' ) as m :
203
203
yield m
204
204
205
- @pytest .yield_fixture
205
+ @pytest .fixture
206
206
def _process_types_mock (self ):
207
207
with patch ('sqlalchemydiff.comparer._process_types' ) as m :
208
208
yield m
209
209
210
- @pytest .yield_fixture
210
+ @pytest .fixture
211
211
def _process_type_mock (self ):
212
212
with patch ('sqlalchemydiff.comparer._process_type' ) as m :
213
213
yield m
214
214
215
- @pytest .yield_fixture
215
+ @pytest .fixture
216
216
def _get_foreign_keys_info_mock (self ):
217
217
with patch ('sqlalchemydiff.comparer._get_foreign_keys_info' ) as m :
218
218
yield m
219
219
220
- @pytest .yield_fixture
220
+ @pytest .fixture
221
221
def _get_primary_keys_info_mock (self ):
222
222
with patch ('sqlalchemydiff.comparer._get_primary_keys_info' ) as m :
223
223
yield m
224
224
225
- @pytest .yield_fixture
225
+ @pytest .fixture
226
226
def _get_indexes_info_mock (self ):
227
227
with patch ('sqlalchemydiff.comparer._get_indexes_info' ) as m :
228
228
yield m
229
229
230
- @pytest .yield_fixture
230
+ @pytest .fixture
231
231
def _get_columns_info_mock (self ):
232
232
with patch ('sqlalchemydiff.comparer._get_columns_info' ) as m :
233
233
yield m
234
234
235
- @pytest .yield_fixture
235
+ @pytest .fixture
236
236
def _get_constraints_info_mock (self ):
237
237
with patch ('sqlalchemydiff.comparer._get_constraints_info' ) as m :
238
238
yield m
0 commit comments