def test_get_existing_init_path_from_init_dir(self): # first create the init init_path = os.path.join(utils.get_cwd(), constants.CLOUDIFY_WD_SETTINGS_DIRECTORY_NAME) os.mkdir(init_path) self.assertEqual(utils.get_init_path(), init_path)
def test_get_existing_init_path_from_inner_dir(self): # first create the init init_path = os.path.join(utils.get_cwd(), constants.CLOUDIFY_WD_SETTINGS_DIRECTORY_NAME) os.mkdir(init_path) # switch working directory to inner one new_cwd = os.path.join(utils.get_cwd(), 'test_get_existing_init_path') os.mkdir(new_cwd) utils.get_cwd = lambda: new_cwd self.assertEqual(utils.get_init_path(), init_path)
def _workdir(): cloudify_dir = utils.get_init_path() workdir = os.path.join(cloudify_dir, 'bootstrap') if not os.path.isdir(workdir): os.mkdir(workdir) return workdir
def delete_workdir(): cloudify_dir = utils.get_init_path() workdir = os.path.join(cloudify_dir, 'bootstrap') if os.path.exists(workdir): shutil.rmtree(workdir)