Skip to content

Commit 3a359a4

Browse files
mgornymrbean-bremen
authored andcommitted
Skip test_write_excel if openpyxl is not installed
test_write_excel fails if pandas are installed but openpyxl is not. Adjust the condition around the case appropriately.
1 parent eaa6080 commit 3a359a4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pyfakefs/tests/patched_packages_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
except ImportError:
2929
xlrd = None
3030

31+
try:
32+
import openpyxl
33+
except ImportError:
34+
openpyxl = None
35+
3136

3237
class TestPatchedPackages(fake_filesystem_unittest.TestCase):
3338
def setUp(self):
@@ -57,6 +62,7 @@ def test_read_excel(self):
5762
df = pd.read_excel(path)
5863
assert (df.columns == [1, 2, 3, 4]).all()
5964

65+
if pd is not None and openpyxl is not None:
6066
def test_write_excel(self):
6167
self.fs.create_dir('/foo')
6268
path = '/foo/bar.xlsx'

0 commit comments

Comments
 (0)