Skip to content

Commit c069896

Browse files
committed
💚 update broken unit tests
1 parent de42a21 commit c069896

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

Diff for: pyexcel-odsr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ dependencies:
1111
test_dependencies:
1212
- pyexcel
1313
- psutil
14-
- pyexcel-ods
15-
- pyexcel-xls
14+
- pyexcel-ods>=0.6.0
15+
- pyexcel-xls>=0.6.0
1616
keywords:
1717
- excel
1818
- ods

Diff for: tests/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ moban
1111
moban_jinja2_github
1212
pyexcel
1313
psutil
14-
pyexcel-ods
15-
pyexcel-xls
14+
pyexcel-ods>=0.6.0
15+
pyexcel-xls>=0.6.0

Diff for: tests/test_fods_reader.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import os
22

33
from base import ODSCellTypes
4+
from pyexcel_io.reader import Reader
45

56
from pyexcel_odsr.odsr import FODSBook
67

78

89
class TestFODSReader(ODSCellTypes):
910
def setUp(self):
10-
r = FODSBook(
11-
os.path.join("tests", "fixtures", "ods_formats.fods"), "fods"
12-
)
11+
r = Reader("fods")
12+
r.reader_class = FODSBook
13+
r.open(os.path.join("tests", "fixtures", "ods_formats.fods"))
1314
self.data = r.read_all()
1415
for key in self.data.keys():
1516
self.data[key] = list(self.data[key])
@@ -21,7 +22,9 @@ def setUp(self):
2122
with open(
2223
os.path.join("tests", "fixtures", "ods_formats.fods"), "rb"
2324
) as f:
24-
r = FODSBook(f, "fods")
25+
r = Reader("fods")
26+
r.reader_class = FODSBook
27+
r.open_stream(f)
2528
self.data = r.read_all()
2629
for key in self.data.keys():
2730
self.data[key] = list(self.data[key])

Diff for: tests/test_ods_reader.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
from base import ODSCellTypes
44
from pyexcel._compact import BytesIO
5+
from pyexcel_io.reader import Reader
6+
from pyexcel_io.writer import Writer
57
from pyexcel_ods.odsw import ODSWriter
68

79
from pyexcel_odsr.odsr import ODSBook
810

911

1012
class TestODSReader(ODSCellTypes):
1113
def setUp(self):
12-
r = ODSBook(
13-
os.path.join("tests", "fixtures", "ods_formats.ods"), "ods"
14-
)
14+
r = Reader("fods")
15+
r.reader_class = ODSBook
16+
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
1517
self.data = r.read_all()
1618
for key in self.data.keys():
1719
self.data[key] = list(self.data[key])
@@ -23,7 +25,9 @@ def setUp(self):
2325
with open(
2426
os.path.join("tests", "fixtures", "ods_formats.ods"), "rb"
2527
) as f:
26-
r = ODSBook(f, "ods")
28+
r = Reader("fods")
29+
r.reader_class = ODSBook
30+
r.open_stream(f)
2731
self.data = r.read_all()
2832
for key in self.data.keys():
2933
self.data[key] = list(self.data[key])
@@ -36,7 +40,9 @@ def setUp(self):
3640
os.path.join("tests", "fixtures", "ods_formats.ods"), "rb"
3741
) as f:
3842
io = BytesIO(f.read())
39-
r = ODSBook(io, "ods")
43+
r = Reader("fods")
44+
r.reader_class = ODSBook
45+
r.open_stream(io)
4046
self.data = r.read_all()
4147
for key in self.data.keys():
4248
self.data[key] = list(self.data[key])
@@ -45,18 +51,22 @@ def setUp(self):
4551

4652
class TestODSWriter(ODSCellTypes):
4753
def setUp(self):
48-
r = ODSBook(
49-
os.path.join("tests", "fixtures", "ods_formats.ods"), "ods"
50-
)
54+
r = Reader("fods")
55+
r.reader_class = ODSBook
56+
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
5157
self.data1 = r.read_all()
58+
r.close()
5259
self.testfile = "odswriter.ods"
53-
w = ODSWriter(self.testfile, "ods")
60+
w = Writer("ods")
61+
w.writer_class = ODSWriter
62+
w.open(self.testfile)
5463
w.write(self.data1)
5564
w.close()
56-
r2 = ODSBook(self.testfile, "ods")
57-
self.data = r2.read_all()
65+
r.open(self.testfile)
66+
self.data = r.read_all()
5867
for key in self.data.keys():
5968
self.data[key] = list(self.data[key])
69+
r.close()
6070

6171
def tearDown(self):
6272
if os.path.exists(self.testfile):

0 commit comments

Comments
 (0)