Quantcast
Channel: How to test a function that creates a directory? - Stack Overflow
Browsing all 3 articles
Browse latest View live

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 Article



Answer 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 Article

How 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
Browsing all 3 articles
Browse latest View live




Latest Images