def __init__(self, relative_path, in_place=False): self.short_name = relative_path src = os.path.join(conftest.PROJECT_DIR, relative_path) if in_place: self.folder = src self.target = relative_path else: for fname in os.listdir(src): fsrc = os.path.join(src, fname) fdest = os.path.join(os.getcwd(), fname) if os.path.isdir(fsrc): shutil.copytree(fsrc, fdest) else: shutil.copy(fsrc, fdest) shutil.copystat(fsrc, fdest) self.folder = os.getcwd() self.target = self.folder self.preparation = [] self.commands = [] self.commands.extend(SCENARIO_COMMANDS) extra_commands = os.path.join(self.folder, ".commands") if os.path.isfile(extra_commands): self.target = None with io.open(extra_commands, "rt") as fh: for line in fh: line = conftest.decode(line).strip() if line: if line.startswith(":"): self.preparation.append(line[1:]) else: self.commands.append(line)
def __init__(self, folder): self.folder = os.path.join(conftest.PROJECT_DIR, folder) self.commands = [] self.commands.extend(SCENARIO_COMMANDS) self.target = folder extra_commands = os.path.join(folder, '.commands') if os.path.isfile(extra_commands): self.target = None with open(extra_commands) as fh: for line in fh: line = conftest.decode(line).strip() if line: self.commands.append(line)
def __init__(self, folder): self.folder = os.path.join(conftest.PROJECT_DIR, folder) self.preparation = [] self.commands = [] self.commands.extend(SCENARIO_COMMANDS) self.target = folder extra_commands = os.path.join(folder, ".commands") if os.path.isfile(extra_commands): self.target = None with io.open(extra_commands, "rt") as fh: for line in fh: line = conftest.decode(line).strip() if line: if line.startswith(":"): self.preparation.append(line[1:]) else: self.commands.append(line)