示例#1
0
 def test_creates_directories(self):
     # When given directory specifications, it creates those directories.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/', None), ('b/', None)])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), DirExists())
     self.assertThat(os.path.join(path, 'b'), DirExists())
示例#2
0
 def test_creates_directories(self):
     # When given directory specifications, it creates those directories.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a/', None), ('b/', None)])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), DirExists())
     self.assertThat(os.path.join(path, 'b'), DirExists())
示例#3
0
 def test_creates_files(self):
     # When given a list of file specifications, it creates those files
     # underneath the temporary directory.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a', 'foo'), ('b', 'bar')])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), FileContains('foo'))
     self.assertThat(os.path.join(path, 'b'), FileContains('bar'))
示例#4
0
 def test_creates_files(self):
     # When given a list of file specifications, it creates those files
     # underneath the temporary directory.
     path = self.useFixture(TempDir()).path
     create_normal_shape(path, [('a', 'foo'), ('b', 'bar')])
     self.assertThat(path, DirContains(['a', 'b']))
     self.assertThat(os.path.join(path, 'a'), FileContains('foo'))
     self.assertThat(os.path.join(path, 'b'), FileContains('bar'))
示例#5
0
 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'))
示例#6
0
 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'))
示例#7
0
 def test_empty(self):
     tempdir = self.useFixture(TempDir()).path
     create_normal_shape(tempdir, [])
     self.assertThat(tempdir, DirContains([]))
示例#8
0
 def test_empty(self):
     tempdir = self.useFixture(TempDir()).path
     create_normal_shape(tempdir, [])
     self.assertThat(tempdir, DirContains([]))