Skip to content

Commit b478029

Browse files
committed
setUp/tearDown -> setup_method/teardown_method
1 parent 758f3e5 commit b478029

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

tests/test_filter.py

Lines changed: 2 additions & 2 deletions
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.xls"
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_writing_date_format(self):
6262

6363

6464
class TestAutoDetectInt:
65-
def setUp(self):
65+
def setup_method(self):
6666
self.content = [[1, 2, 3.1]]
6767
self.test_file = "test_auto_detect_init.xls"
6868
pe.save_as(array=self.content, dest_file_name=self.test_file)
@@ -119,5 +119,5 @@ def test_get_book_auto_detect_int_false(self):
119119
).strip()
120120
assert str(book) == expected
121121

122-
def tearDown(self):
122+
def teardown_method(self):
123123
os.unlink(self.test_file)

tests/test_multiple_sheets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414

1515
class TestXlsNxlsMultipleSheets(PyexcelMultipleSheetBase):
16-
def setUp(self):
16+
def setup_method(self):
1717
self.testfile = "multiple1.xls"
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

@@ -35,7 +35,7 @@ def _write_test_file(self, file):
3535
self.rows = 3
3636
pyexcel.save_book_as(bookdict=self.content, dest_file_name=file)
3737

38-
def setUp(self):
38+
def setup_method(self):
3939
self.testfile = "multiple1.xls"
4040
self.testfile2 = "multiple2.xls"
4141
self.testfile3 = "multiple3.xls"
@@ -208,15 +208,15 @@ def test_add_book_error(self):
208208
except TypeError:
209209
assert 1 == 1
210210

211-
def tearDown(self):
211+
def teardown_method(self):
212212
if os.path.exists(self.testfile):
213213
os.unlink(self.testfile)
214214
if os.path.exists(self.testfile2):
215215
os.unlink(self.testfile2)
216216

217217

218218
class TestMultiSheetReader:
219-
def setUp(self):
219+
def setup_method(self):
220220
self.testfile = "file_with_an_empty_sheet.xls"
221221

222222
def test_reader_with_correct_sheets(self):

tests/test_writer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ def test_write_book(self):
2121
content[key] = list(content[key])
2222
assert content == self.content
2323

24-
def tearDown(self):
24+
def teardown_method(self):
2525
if os.path.exists(self.testfile):
2626
os.unlink(self.testfile)
2727

2828

2929
class TestxlsnCSVWriter(PyexcelWriterBase):
30-
def setUp(self):
30+
def setup_method(self):
3131
self.testfile = "test.xls"
3232
self.testfile2 = "test.csv"
3333

34-
def tearDown(self):
34+
def teardown_method(self):
3535
if os.path.exists(self.testfile):
3636
os.unlink(self.testfile)
3737
if os.path.exists(self.testfile2):
3838
os.unlink(self.testfile2)
3939

4040

4141
class TestxlsHatWriter(PyexcelHatWriterBase):
42-
def setUp(self):
42+
def setup_method(self):
4343
self.testfile = "test.xls"
4444

45-
def tearDown(self):
45+
def teardown_method(self):
4646
if os.path.exists(self.testfile):
4747
os.unlink(self.testfile)

0 commit comments

Comments
 (0)