Answer by idjaw for How to test a function that creates a directory?
A good practice here would be to learn how to use testing frameworks like mock or flexmockFurthermore, you should use Python's unittest Framework.Your objective here is not necessarily to make sure...
View ArticleAnswer by hspandher for How to test a function that creates a directory?
Just test that directory existsdef test_make_directory(self): directory_path = '...' # somepath make_directory(directory_path) self.assertTrue(os.path.exists(directory_path))And do ensure that any...
View ArticleHow to test a function that creates a directory?
How to test a function in Python which creates a directory? Can you give an example make_directory_test() function?def make_directory(directory): if not os.path.exists(directory): os.makedirs(directory)
View Article
More Pages to Explore .....