Skip to content

Commit ee290e0

Browse files
committed
fix: tests windows
1 parent ba0056c commit ee290e0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/test_write.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def test_opf_present(self, tmp_path):
112112

113113
class TestValidation:
114114
def test_missing_identifier_raises(self):
115+
import io
115116
book = epub.EpubBook()
116117
book.set_title("Test")
117118
book.set_language("en")
@@ -120,9 +121,10 @@ def test_missing_identifier_raises(self):
120121
book.add_item(c1)
121122
book.spine = [c1]
122123
with pytest.raises(ValueError, match="identifier"):
123-
epub.write_epub("/tmp/should_not_exist.epub", book)
124+
epub.write_epub(io.BytesIO(), book)
124125

125126
def test_missing_title_raises(self):
127+
import io
126128
book = epub.EpubBook()
127129
book.set_identifier("id")
128130
book.set_language("en")
@@ -131,9 +133,10 @@ def test_missing_title_raises(self):
131133
book.add_item(c1)
132134
book.spine = [c1]
133135
with pytest.raises(ValueError, match="title"):
134-
epub.write_epub("/tmp/should_not_exist.epub", book)
136+
epub.write_epub(io.BytesIO(), book)
135137

136138
def test_missing_language_raises(self):
139+
import io
137140
book = epub.EpubBook()
138141
book.set_identifier("id")
139142
book.set_title("Test")
@@ -142,15 +145,16 @@ def test_missing_language_raises(self):
142145
book.add_item(c1)
143146
book.spine = [c1]
144147
with pytest.raises(ValueError, match="language"):
145-
epub.write_epub("/tmp/should_not_exist.epub", book)
148+
epub.write_epub(io.BytesIO(), book)
146149

147150
def test_empty_spine_raises(self):
151+
import io
148152
book = epub.EpubBook()
149153
book.set_identifier("id")
150154
book.set_title("Test")
151155
book.set_language("en")
152156
with pytest.raises(ValueError, match="spine"):
153-
epub.write_epub("/tmp/should_not_exist.epub", book)
157+
epub.write_epub(io.BytesIO(), book)
154158

155159

156160
class TestAuthors:

0 commit comments

Comments
 (0)