def tes_mkdir_raises_when_path_is_not_a_dir():
 mox = Mox()
 mox.StubOutWithMock(io, 'os')
 mox.StubOutWithMock(io.os, 'path')
 class MyFs(io.FileSystem, ):
  pass
 oserror = OSError()
 oserror.errno = 17
 io.os.makedirs('/make/all/those/subdirs').AndRaise(oserror)
 io.os.isdir('/make/all/those/subdirs').AndReturn(False)
 mox.ReplayAll()
 try:
  assert_raises(OSError, MyFs.mkdir, '/make/all/those/subdirs')
  mox.VerifyAll()
 finally:
  mox.UnsetStubs()

def tes_mkdir_raises_when_path_is_not_a_dir ( ) : mox = Mox ( ) mox . StubOutWithMock ( io , 'os' ) mox . StubOutWithMock ( io . os , 'path' ) class MyFs ( io . FileSystem , ) : pass oserror = OSError ( ) oserror . errno = 17 io . os . makedirs ( '/make/all/those/subdirs' ) . AndRaise ( oserror ) io . os . isdir ( '/make/all/those/subdirs' ) . AndReturn ( False ) mox . ReplayAll ( ) try : assert_raises ( OSError , MyFs . mkdir , '/make/all/those/subdirs' ) mox . VerifyAll ( ) finally : mox . UnsetStubs ( )
test mkdir raises when path is not a dir .