def tmpcase(tmpdir): """An empty Case instance which has been created in a temporary directory. """ from firefish.case import Case case_dir = tmpdir.join('temp_case') return Case(case_dir.strpath)
def create_new_case(case_dir): # Check that the specified case directory does not already exist if os.path.exists(case_dir): raise RuntimeError( 'Refusing to write to existing path: {}'.format(case_dir)) # Create the case return Case(case_dir)
def create_new_case(case_dir): """Creates new case directory""" #Checks to make sure we don't overwite an existing case if os.path.exists(case_dir): raise RuntimeError( 'Refusing to write to existing path: {}'.format(case_dir)) #Creates the case return Case(case_dir)
def create_new_case(case_dir): """Creates new case directory""" # Check that the specified case directory does not already exist if os.path.exists(case_dir): call(["rm", "-r", "snappy"]) #raise RuntimeError( # 'Refusing to write to existing path: {}'.format(case_dir) #) # Create the case return Case(case_dir)
def test_case_created(tmpdir): """If create is True, the case directory is created.""" case_dir = tmpdir.join('does_not_exist') assert not case_dir.check() Case(case_dir.strpath) assert case_dir.check()
def test_case_must_exist(tmpdir): """If create is False, the case directory must exist.""" case_dir = tmpdir.join('does_not_exist') assert not case_dir.check() with pytest.raises(CaseDoesNotExist): Case(case_dir.strpath, create=False)