File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import time
66import warnings
77
88from csv import QUOTE_MINIMAL, QUOTE_NONNUMERIC, QUOTE_NONE
9+ from errno import ENOENT
910
1011from libc.stdlib cimport free
1112from libc.string cimport strncpy, strlen, strcasecmp
@@ -696,7 +697,9 @@ cdef class TextReader:
696697 if ptr == NULL :
697698 if not os.path.exists(source):
698699 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)
700703 raise IOError (' Initializing from file failed' )
701704
702705 self .parser.source = ptr
Original file line number Diff line number Diff line change @@ -898,9 +898,15 @@ def test_nonexistent_path(all_parsers):
898898
899899 msg = ("does not exist" if parser .engine == "c"
900900 else r"\[Errno 2\]" )
901- with pytest .raises (compat .FileNotFoundError , match = msg ):
901+ with pytest .raises (compat .FileNotFoundError , match = msg ) as e :
902902 parser .read_csv (path )
903903
904+ filename = e .value .filename
905+ filename = filename .decode () if isinstance (
906+ filename , bytes ) else filename
907+
908+ assert path == filename
909+
904910
905911def test_missing_trailing_delimiters (all_parsers ):
906912 parser = all_parsers
You can’t perform that action at this time.
0 commit comments