Skip to content

Commit c8dc927

Browse files
committed
TST: Refactor to use setup_class
Pytest won't use setUp unless you inherit from TestCase. These classes don't because they use nose-style generator tests. We change to setup_class becuase that is called by the pytest runner.
1 parent 9b5f2b2 commit c8dc927

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

pandas/io/tests/test_packers.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -793,18 +793,19 @@ class TestMsgpack():
793793
http://stackoverflow.com/questions/6689537/nose-test-generators-inside-class
794794
"""
795795

796-
def setUp(self):
796+
@classmethod
797+
def setup_class(cls):
797798
from pandas.io.tests.generate_legacy_storage_files import (
798799
create_msgpack_data, create_data)
799-
self.data = create_msgpack_data()
800-
self.all_data = create_data()
801-
self.path = u('__%s__.msgpack' % tm.rands(10))
802-
self.minimum_structure = {'series': ['float', 'int', 'mixed',
803-
'ts', 'mi', 'dup'],
804-
'frame': ['float', 'int', 'mixed', 'mi'],
805-
'panel': ['float'],
806-
'index': ['int', 'date', 'period'],
807-
'mi': ['reg2']}
800+
cls.data = create_msgpack_data()
801+
cls.all_data = create_data()
802+
cls.path = u('__%s__.msgpack' % tm.rands(10))
803+
cls.minimum_structure = {'series': ['float', 'int', 'mixed',
804+
'ts', 'mi', 'dup'],
805+
'frame': ['float', 'int', 'mixed', 'mi'],
806+
'panel': ['float'],
807+
'index': ['int', 'date', 'period'],
808+
'mi': ['reg2']}
808809

809810
def check_min_structure(self, data):
810811
for typ, v in self.minimum_structure.items():

pandas/io/tests/test_pickle.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ class TestPickle():
3131
nose-test-generators-inside-class
3232
"""
3333

34-
def setUp(self):
34+
@classmethod
35+
def setup_class(cls):
3536
from pandas.io.tests.generate_legacy_storage_files import (
3637
create_pickle_data)
37-
self.data = create_pickle_data()
38-
self.path = u('__%s__.pickle' % tm.rands(10))
38+
cls.data = create_pickle_data()
39+
cls.path = u('__%s__.pickle' % tm.rands(10))
3940

4041
def compare_element(self, result, expected, typ, version=None):
4142
if isinstance(expected, Index):

0 commit comments

Comments
 (0)