Skip to content

Commit e345cbc

Browse files
committed
setUp/tearDown -> setup_method/teardown_method
This is what pytest uses
1 parent 404531c commit e345cbc

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

tests/test_filter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class TestFilter:
9-
def setUp(self):
9+
def setup_method(self):
1010
self.test_file = "test_filter.ods"
1111
sample = [
1212
[1, 21, 31],
@@ -69,5 +69,5 @@ def test_filter_both_ways_2(self):
6969
expected = [[24]]
7070
assert filtered_data[self.sheet_name] == expected
7171

72-
def tearDown(self):
72+
def teardown_method(self):
7373
os.unlink(self.test_file)

tests/test_formatters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class TestAutoDetectInt:
10-
def setUp(self):
10+
def setup_method(self):
1111
self.content = [[1, 2, 3.1]]
1212
self.test_file = "test_auto_detect_init.ods"
1313
pe.save_as(array=self.content, dest_file_name=self.test_file)
@@ -64,5 +64,5 @@ def test_get_book_auto_detect_int_false(self):
6464
).strip()
6565
assert str(book) == expected
6666

67-
def tearDown(self):
67+
def teardown_method(self):
6868
os.unlink(self.test_file)

tests/test_multiple_sheets.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313

1414

1515
class TestOdsNxlsMultipleSheets(PyexcelMultipleSheetBase):
16-
def setUp(self):
16+
def setup_method(self):
1717
self.testfile = "multiple1.ods"
1818
self.testfile2 = "multiple1.xls"
1919
self.content = _produce_ordered_dict()
2020
self._write_test_file(self.testfile)
2121

22-
def tearDown(self):
22+
def teardown_method(self):
2323
self._clean_up()
2424

2525

2626
class TestXlsNOdsMultipleSheets(PyexcelMultipleSheetBase):
27-
def setUp(self):
27+
def setup_method(self):
2828
self.testfile = "multiple1.xls"
2929
self.testfile2 = "multiple1.ods"
3030
self.content = _produce_ordered_dict()
3131
self._write_test_file(self.testfile)
3232

33-
def tearDown(self):
33+
def teardown_method(self):
3434
self._clean_up()
3535

3636

@@ -46,7 +46,7 @@ def _write_test_file(self, file):
4646
self.rows = 3
4747
pyexcel.save_book_as(bookdict=self.content, dest_file_name=file)
4848

49-
def setUp(self):
49+
def setup_method(self):
5050
self.testfile = "multiple1.ods"
5151
self.testfile2 = "multiple1.xls"
5252
self.content = _produce_ordered_dict()
@@ -218,15 +218,15 @@ def test_add_book_error(self):
218218
except TypeError:
219219
assert 1 == 1
220220

221-
def tearDown(self):
221+
def teardown_method(self):
222222
if os.path.exists(self.testfile):
223223
os.unlink(self.testfile)
224224
if os.path.exists(self.testfile2):
225225
os.unlink(self.testfile2)
226226

227227

228228
class TestMultiSheetReader:
229-
def setUp(self):
229+
def setup_method(self):
230230
self.testfile = "file_with_an_empty_sheet.ods"
231231

232232
def test_reader_with_correct_sheets(self):

tests/test_ods_reader.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class TestODSReader(ODSCellTypes):
10-
def setUp(self):
10+
def setup_method(self):
1111
r = Reader("ods")
1212
r.reader_class = ODSBook
1313
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
@@ -18,7 +18,7 @@ def setUp(self):
1818

1919

2020
class TestODSWriter(ODSCellTypes):
21-
def setUp(self):
21+
def setup_method(self):
2222
r = Reader("ods")
2323
r.reader_class = ODSBook
2424
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
@@ -33,6 +33,6 @@ def setUp(self):
3333
for key in self.data.keys():
3434
self.data[key] = list(self.data[key])
3535

36-
def tearDown(self):
36+
def teardown_method(self):
3737
if os.path.exists(self.testfile):
3838
os.unlink(self.testfile)

tests/test_writer.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ def test_write_book(self):
1919
content = get_data(self.testfile, library="pyexcel-ods")
2020
assert content == self.content
2121

22-
def tearDown(self):
22+
def teardown_method(self):
2323
if os.path.exists(self.testfile):
2424
os.unlink(self.testfile)
2525

2626

2727
class TestodsnCSVWriter(PyexcelWriterBase):
28-
def setUp(self):
28+
def setup_method(self):
2929
self.testfile = "test.ods"
3030
self.testfile2 = "test.csv"
3131

32-
def tearDown(self):
32+
def teardown_method(self):
3333
if os.path.exists(self.testfile):
3434
os.unlink(self.testfile)
3535
if os.path.exists(self.testfile2):
3636
os.unlink(self.testfile2)
3737

3838

3939
class TestodsHatWriter(PyexcelHatWriterBase):
40-
def setUp(self):
40+
def setup_method(self):
4141
self.testfile = "test.ods"
4242

43-
def tearDown(self):
43+
def teardown_method(self):
4444
if os.path.exists(self.testfile):
4545
os.unlink(self.testfile)

0 commit comments

Comments
 (0)