diff options
author | Jonathan Lange <jml@canonical.com> | 2012-07-21 22:49:12 +0100 |
---|---|---|
committer | Jonathan Lange <jml@canonical.com> | 2012-07-21 22:49:12 +0100 |
commit | b01bf579fd50cbc1a90e54ad55f828857b4bf9a2 (patch) | |
tree | 0248b1b6417c167d32960400445ef5930829b2c6 /lib/fixtures/tests | |
parent | c6c9b0f161fdfd6bd1cea6bc4b2797deee6ab1a4 (diff) | |
download | fixtures-b01bf579fd50cbc1a90e54ad55f828857b4bf9a2.tar.gz |
Create parent directories.
Diffstat (limited to 'lib/fixtures/tests')
-rw-r--r-- | lib/fixtures/tests/_fixtures/test_filetree.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/fixtures/tests/_fixtures/test_filetree.py b/lib/fixtures/tests/_fixtures/test_filetree.py index 2da6ff6..c0f2c7e 100644 --- a/lib/fixtures/tests/_fixtures/test_filetree.py +++ b/lib/fixtures/tests/_fixtures/test_filetree.py @@ -166,3 +166,13 @@ class TestCreateNormalShape(TestCase): self.assertThat(os.path.join(path, 'a'), DirExists()) self.assertThat(os.path.join(path, 'b'), DirExists()) + def test_creates_parent_directories(self): + # If the parents of a file or directory don't exist, they get created + # too. + path = self.useFixture(TempDir()).path + create_normal_shape(path, [('a/b/', None), ('c/d.txt', 'text')]) + self.assertThat(path, DirContains(['a', 'c'])) + self.assertThat(os.path.join(path, 'a'), DirContains('b')) + self.assertThat(os.path.join(path, 'a', 'b'), DirExists()) + self.assertThat(os.path.join(path, 'c'), DirExists()) + self.assertThat(os.path.join(path, 'c', 'd.txt'), FileContains('text')) |