Skip to content

Commit 41f1216

Browse files
gfyoungjreback
authored andcommitted
TST: Fix MMapWrapper init test for Windows
Turns out Windows errors differently when an invalid `fileno` is passed into the `mmap` constructor, so there's no need to skip the test (xref: 9670b31). Author: gfyoung <[email protected]> Closes pandas-dev#13494 from gfyoung/mmap-wrapper-init-test-fix and squashes the following commits: db7c6b1 [gfyoung] TST: Fix MMapWrapper init test for Windows
1 parent 1a12ead commit 41f1216

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pandas/io/tests/test_common.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Tests for the pandas.io.common functionalities
33
"""
4-
import nose
54
import mmap
65
import os
76
from os.path import isabs
@@ -98,15 +97,18 @@ def setUp(self):
9897
'test_mmap.csv')
9998

10099
def test_constructor_bad_file(self):
101-
if is_platform_windows():
102-
raise nose.SkipTest("skipping construction error messages "
103-
"tests on windows")
104-
105100
non_file = StringIO('I am not a file')
106101
non_file.fileno = lambda: -1
107102

108-
msg = "Invalid argument"
109-
tm.assertRaisesRegexp(mmap.error, msg, common.MMapWrapper, non_file)
103+
# the error raised is different on Windows
104+
if is_platform_windows():
105+
msg = "The parameter is incorrect"
106+
err = OSError
107+
else:
108+
msg = "Invalid argument"
109+
err = mmap.error
110+
111+
tm.assertRaisesRegexp(err, msg, common.MMapWrapper, non_file)
110112

111113
target = open(self.mmap_file, 'r')
112114
target.close()

0 commit comments

Comments
 (0)