def step_a_new_working_directory(context): """ Creates a new, empty working directory """ command_util.ensure_context_attribute_exists(context, "workdir", None) command_util.ensure_workdir_exists(context) shutil.rmtree(context.workdir, ignore_errors=True)
def step_a_file_named_filename_with(context, filename): """ Creates a textual file with the content provided as docstring. """ assert context.text is not None, "ENSURE: multiline text is provided." assert not os.path.isabs(filename) command_util.ensure_workdir_exists(context) filename2 = os.path.join(context.workdir, filename) command_util.create_textfile_with_contents(filename2, context.text) # -- SPECIAL CASE: For usage with behave steps. if filename.endswith(".feature"): command_util.ensure_context_attribute_exists(context, "features", []) context.features.append(filename)
def step_a_file_named_filename_with(context, filename): """ Creates a textual file with the content provided as docstring. """ assert context.text is not None, "ENSURE: multiline text is provided." assert not os.path.isabs(filename) command_util.ensure_workdir_exists(context) filename2 = os.path.join(context.workdir, filename) pathutil.create_textfile_with_contents(filename2, context.text) # -- SPECIAL CASE: For usage with behave steps. if filename.endswith(".feature"): command_util.ensure_context_attribute_exists(context, "features", []) context.features.append(filename)