mardi 2 août 2016

Does assertRaises work on builtin exceptions

  • I have a function that wraps os remove.
  • I have unit test setup as follows:

    self.assertRaises(FileNotFoundError, my_rm(bad_file_path))

bad_file_path does not exist, so it throws exception. However, the above still fails testing. How could I test for FileNotFoundError, if possible?

Aucun commentaire:

Enregistrer un commentaire