Created
December 13, 2018 14:18
-
-
Save Bas-Man/5869412f93469f4654e6618091ddbc83 to your computer and use it in GitHub Desktop.
How to catch an OSError for invalid directory path or file in UnitTest in Python 3.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def testValidatePathFile(self): | |
with self.assertRaises(OSError) as cm: | |
# self.handle.__ValidatePathFile() | |
self.handle = exceptman.ExceptionListManager(path="/tm") | |
err = cm.exception | |
self.assertEqual(str(err), "[Errno 2] No such file or directory: '/tm'") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment