Exemplo n.º 1
0
def test_ensure_dir(tc):
    dirname = os.path.join(tc.sandbox(), "sub")
    tc.assertFalse(os.path.exists(dirname))
    utils.ensure_dir(dirname)
    tc.assertTrue(os.path.isdir(dirname))
    utils.ensure_dir(dirname)
    tc.assertTrue(os.path.isdir(dirname))
    with tc.assertRaises(EnvironmentError) as ar:
        utils.ensure_dir(os.path.join(tc.sandbox(), "nonex", "sub"))
    tc.assertEqual(ar.exception.errno, errno.ENOENT)
Exemplo n.º 2
0
def test_ensure_dir(tc):
    dirname = os.path.join(tc.sandbox(), "sub")
    tc.assertFalse(os.path.exists(dirname))
    utils.ensure_dir(dirname)
    tc.assertTrue(os.path.isdir(dirname))
    utils.ensure_dir(dirname)
    tc.assertTrue(os.path.isdir(dirname))
    with tc.assertRaises(EnvironmentError) as ar:
        utils.ensure_dir(os.path.join(tc.sandbox(), "nonex", "sub"))
    tc.assertEqual(ar.exception.errno, errno.ENOENT)
Exemplo n.º 3
0
 def _ensure_dir(self, pathname):
     # For overriding in the testsuite
     utils.ensure_dir(pathname)
Exemplo n.º 4
0
 def _ensure_dir(self, pathname):
     # For overriding in the testsuite
     utils.ensure_dir(pathname)