|
8 | 8 |
|
9 | 9 | class TestConfig(object): |
10 | 10 |
|
11 | | - def __init__(self, *args): |
12 | | - super(TestConfig, self).__init__(*args) |
13 | | - |
| 11 | + @classmethod |
| 12 | + def setup_class(cls): |
14 | 13 | from copy import deepcopy |
15 | | - self.cf = pd.core.config |
16 | | - self.gc = deepcopy(getattr(self.cf, '_global_config')) |
17 | | - self.do = deepcopy(getattr(self.cf, '_deprecated_options')) |
18 | | - self.ro = deepcopy(getattr(self.cf, '_registered_options')) |
| 14 | + |
| 15 | + cls.cf = pd.core.config |
| 16 | + cls.gc = deepcopy(getattr(cls.cf, '_global_config')) |
| 17 | + cls.do = deepcopy(getattr(cls.cf, '_deprecated_options')) |
| 18 | + cls.ro = deepcopy(getattr(cls.cf, '_registered_options')) |
19 | 19 |
|
20 | 20 | def setup_method(self, method): |
21 | 21 | setattr(self.cf, '_global_config', {}) |
22 | | - setattr( |
23 | | - self.cf, 'options', self.cf.DictWrapper(self.cf._global_config)) |
| 22 | + setattr(self.cf, 'options', self.cf.DictWrapper( |
| 23 | + self.cf._global_config)) |
24 | 24 | setattr(self.cf, '_deprecated_options', {}) |
25 | 25 | setattr(self.cf, '_registered_options', {}) |
26 | 26 |
|
| 27 | + # Our test fixture in conftest.py sets "chained_assignment" |
| 28 | + # to "raise" only after all test methods have been setup. |
| 29 | + # However, after this setup, there is no longer any |
| 30 | + # "chained_assignment" option, so re-register it. |
| 31 | + self.cf.register_option('chained_assignment', 'raise') |
| 32 | + |
27 | 33 | def teardown_method(self, method): |
28 | 34 | setattr(self.cf, '_global_config', self.gc) |
29 | 35 | setattr(self.cf, '_deprecated_options', self.do) |
|
0 commit comments