def __init__(self, pytest_request): testcase_name = calculate_testcase_name(pytest_request) relative_report_dir = pytest_request.config.getoption("--reports") absolute_framework_dir = Path.cwd() self.testcase_parameters = { "dirs": { "working_dir": Path(absolute_framework_dir, relative_report_dir, testcase_name), "relative_working_dir": Path(relative_report_dir, testcase_name), "install_dir": Path(pytest_request.config.getoption("--installdir")), "shared_dir": Path(absolute_framework_dir, "shared_files"), }, "file_paths": { "testcase_file": Path(pytest_request.fspath), }, "testcase_name": testcase_name, "external_tool": pytest_request.config.getoption("--run-under"), }
def __init__(self, pytest_request): testcase_name = calculate_testcase_name(pytest_request.node.name) for item in pytest_request.node.user_properties: if item[0] == "working_dir": self.working_dir = None self.set_working_dir(item[1]) elif item[0] == "relative_working_dir": self.relative_working_dir = None self.set_relative_working_dir(item[1]) absolute_framework_dir = Path(__file__).parents[2] self.testcase_parameters = { "dirs": { "install_dir": Path(pytest_request.config.getoption("--installdir")), "shared_dir": Path(absolute_framework_dir, "shared_files"), }, "file_paths": { "testcase_file": Path(pytest_request.fspath), }, "testcase_name": testcase_name, "external_tool": pytest_request.config.getoption("--run-under"), }
def calculate_working_dir(pytest_config_object, testcase_name): report_dir = Path(pytest_config_object.getoption("--reports")).absolute() return Path(report_dir, calculate_testcase_name(testcase_name))
def construct_report_file_path(item): relative_report_dir = item._request.config.getoption("--reports") testcase_name = calculate_testcase_name(item._request) file_name = "testcase_{}.log".format(testcase_name) return str(Path(relative_report_dir, testcase_name, file_name).absolute())