* Brian van den Broek wrote: > The relevant part of the validation method code looks like: > > # self.universe_files is a list of file paths > non_existent_files = [ x for x in self.universe_files if > not os.path.isfile(x) ] > if non_existent_files: > raise Files_dont_existError, non_existent_files > > I can test the custom error class just fine, but I don't see how to > test the validation method itself.
The logic is simple -- you don't want to test os.path.isfile, so mock it. Just encapsulate the os.path.isfile call in an own method, which can be overridden by your test. nd -- # Andrà Malo, <http://pub.perlig.de/> # -- http://mail.python.org/mailman/listinfo/python-list