From fc2c75ee9c05ed4c9dece9cc5188915bc77c52ed Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 23 Sep 2014 18:49:38 -0700 Subject: [PATCH] Tests for mkdirall A red herring. I thought this might be responsible for #969. --- test/test_files.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_files.py b/test/test_files.py index 398b6ceb8..1eb54ffa3 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -588,6 +588,22 @@ class UniquePathTest(_common.TestCase): self.assertEqual(path, os.path.join(self.base, 'x.3.mp3')) +class MkDirAllTest(_common.TestCase): + def test_parent_exists(self): + path = os.path.join(self.temp_dir, 'foo', 'bar', 'baz', 'qux.mp3') + util.mkdirall(path) + self.assertTrue(os.path.isdir( + os.path.join(self.temp_dir, 'foo', 'bar', 'baz') + )) + + def test_child_does_not_exist(self): + path = os.path.join(self.temp_dir, 'foo', 'bar', 'baz', 'qux.mp3') + util.mkdirall(path) + self.assertTrue(not os.path.exists( + os.path.join(self.temp_dir, 'foo', 'bar', 'baz', 'qux.mp3') + )) + + def suite(): return unittest.TestLoader().loadTestsFromName(__name__)