MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testMkdir

Method testMkdir

test/IECore/IndexedIO.py:216–241  ·  view source on GitHub ↗

Test FileIndexedIO mkdir

(self)

Source from the content-addressed store, hash-verified

214 self.assertTrue( g.entry('sub2').entryType() == IECore.IndexedIO.EntryType.Directory )
215
216 def testMkdir(self):
217 """Test FileIndexedIO mkdir"""
218 f = IECore.FileIndexedIO(os.path.join( ".", "test", "FileIndexedIO.fio" ), [], IECore.IndexedIO.OpenMode.Write)
219 g = f.subdirectory("sub1", IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
220 self.assertEqual( f.path() , [] )
221 self.assertEqual( f.currentEntryId() , "/" )
222 self.assertEqual( g.path() , [ 'sub1' ] )
223 self.assertEqual( g.currentEntryId() , "sub1" )
224
225 g = f.createSubdirectory("sub2" )
226 self.assertEqual( f.path() , [] )
227 self.assertEqual( g.path() , [ 'sub2' ] )
228 self.assertEqual( g.currentEntryId() , "sub2" )
229 self.assertRaises( RuntimeError, f.createSubdirectory, "sub2" )
230
231 # test directory
232 h = f.directory(["sub2"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
233 self.assertEqual( h.path() , ["sub2"] )
234 i = f.directory(["sub2","sub2.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
235 self.assertEqual( i.path() , ["sub2","sub2.1"] )
236 j = h.directory(["sub2","sub2.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
237 self.assertEqual( j.path() , ["sub2","sub2.1"] )
238 k = j.directory(["sub3"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
239 self.assertEqual( k.path() , ["sub3"] )
240 l = f.directory(["sub4","sub4.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing )
241 self.assertEqual( l.path() , ["sub4","sub4.1"] )
242
243 def testChdir(self):
244 """Test FileIndexedIO chdir"""

Callers

nothing calls this directly

Calls 7

FileIndexedIOMethod · 0.80
joinMethod · 0.80
subdirectoryMethod · 0.80
currentEntryIdMethod · 0.80
createSubdirectoryMethod · 0.80
pathMethod · 0.45
directoryMethod · 0.45

Tested by

no test coverage detected