Skip to content

Commit

Permalink
Fix Python 2 compliance issue with FileNotFoundError.
Browse files Browse the repository at this point in the history
  • Loading branch information
dharvey-consbio committed Oct 28, 2016
1 parent 5088020 commit 1cdde38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gis_metadata/metadata_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def write(self, use_template=False, out_file_or_path=None, encoding=DEFAULT_ENCO
out_file_or_path = self.out_file_or_path

if not out_file_or_path:
raise FileNotFoundError('Output file path has not been provided')
# FileNotFoundError doesn't exist in Python 2
raise IOError('Output file path has not been provided')

write_element(self.update(use_template), out_file_or_path, encoding)

Expand Down
4 changes: 2 additions & 2 deletions gis_metadata/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def test_generic_parser(self):

self.assertIs(data_map_1, data_map_2, 'Data map was reinitialized after instantiation')

with self.assertRaises(FileNotFoundError):
with self.assertRaises(IOError):
parser.write()

def test_specific_parsers(self):
Expand All @@ -628,7 +628,7 @@ def test_specific_parsers(self):

self.assertIs(data_map_1, data_map_2, 'Data map was reinitialized after instantiation')

with self.assertRaises(FileNotFoundError):
with self.assertRaises(IOError):
parser.write()

with self.assertRaises(ValidationError):
Expand Down

0 comments on commit 1cdde38

Please sign in to comment.