File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import time
6
6
import warnings
7
7
8
8
from csv import QUOTE_MINIMAL, QUOTE_NONNUMERIC, QUOTE_NONE
9
+ from errno import ENOENT
9
10
10
11
from libc.stdlib cimport free
11
12
from libc.string cimport strncpy, strlen, strcasecmp
@@ -696,7 +697,9 @@ cdef class TextReader:
696
697
if ptr == NULL :
697
698
if not os.path.exists(source):
698
699
raise compat.FileNotFoundError(
699
- ' File {source} does not exist' .format(source = source))
700
+ ENOENT,
701
+ ' File {source} does not exist' .format(source = source),
702
+ source)
700
703
raise IOError (' Initializing from file failed' )
701
704
702
705
self .parser.source = ptr
Original file line number Diff line number Diff line change @@ -898,9 +898,15 @@ def test_nonexistent_path(all_parsers):
898
898
899
899
msg = ("does not exist" if parser .engine == "c"
900
900
else r"\[Errno 2\]" )
901
- with pytest .raises (compat .FileNotFoundError , match = msg ):
901
+ with pytest .raises (compat .FileNotFoundError , match = msg ) as e :
902
902
parser .read_csv (path )
903
903
904
+ filename = e .value .filename
905
+ filename = filename .decode () if isinstance (
906
+ filename , bytes ) else filename
907
+
908
+ assert path == filename
909
+
904
910
905
911
def test_missing_trailing_delimiters (all_parsers ):
906
912
parser = all_parsers
You can’t perform that action at this time.
0 commit comments