コード例 #1
0
    def pytest_configure(config):
        if Plugin._tep_reports(config):
            test_listener = AllureListener(config)
            config.pluginmanager.register(test_listener)
            allure_commons.plugin_manager.register(test_listener)
            config.add_cleanup(cleanup_factory(test_listener))

            clean = config.option.clean_alluredir
            file_logger = AllureFileLogger(allure_temp, clean)
            allure_commons.plugin_manager.register(file_logger)
            config.add_cleanup(cleanup_factory(file_logger))
コード例 #2
0
ファイル: plugin.py プロジェクト: jakehoskins/allure-python
def pytest_configure(config):
    report_dir = config.option.allure_report_dir
    test_helper = AllureTestHelper(config)
    allure_commons.plugin_manager.register(test_helper)

    if report_dir:
        test_listener = AllureListener()
        config.pluginmanager.register(test_listener)
        allure_commons.plugin_manager.register(test_listener)

        file_logger = AllureFileLogger(report_dir)
        allure_commons.plugin_manager.register(file_logger)
コード例 #3
0
    def __init__(self, stream_opener, config):
        super(AllureFormatter, self).__init__(stream_opener, config)

        # assert False, stream_opener.name

        self.allure_listener = AllureBehaveListener()
        allure_commons.plugin_manager.register(self.allure_listener)

        file_logger = AllureFileLogger(self.stream_opener.name)
        allure_commons.plugin_manager.register(file_logger)

        self.processed_scenario = None
コード例 #4
0
    def __init__(self, logger_path=DEFAULT_OUTPUT_PATH):
        self.stack = []
        self.items_log = {}
        self.pool_id = None
        self.links = OrderedDict()

        self.reporter = AllureReporter()
        self.listener = AllureListener(self.reporter)
        self.logger = AllureFileLogger(logger_path)

        allure_commons.plugin_manager.register(self.logger)
        allure_commons.plugin_manager.register(self.listener)
コード例 #5
0
ファイル: plugin.py プロジェクト: xifeng/allure-python
def pytest_configure(config):
    report_dir = config.option.allure_report_dir
    clean = config.option.clean_alluredir

    if report_dir:
        report_dir = os.path.abspath(report_dir)

        pytest_bdd_listener = PytestBDDListener()
        config.pluginmanager.register(pytest_bdd_listener)

        file_logger = AllureFileLogger(report_dir, clean)
        allure_commons.plugin_manager.register(file_logger)
        config.add_cleanup(cleanup_factory(file_logger))
コード例 #6
0
    def __init__(self, logger_path=DEFAULT_OUTPUT_PATH):
        self.stack = []
        self.items_log = {}
        self.pool_id = None
        self.links = OrderedDict()
        self._previous_keyword_failed = False
        self._traceback_message = None

        self.reporter = AllureReporter()
        self.listener = AllureListener(self.reporter)
        self.logger = AllureFileLogger(logger_path)

        allure_commons.plugin_manager.register(self.logger)
        allure_commons.plugin_manager.register(self.listener)
コード例 #7
0
    def __init__(self, job: JobSpec):
        self.job = job
        if not job.rerun and not job.is_setup:
            self.file_logger = AllureFileLogger(job.reportdir, False)
            allure_commons.plugin_manager.register(self.file_logger)

            self.reporter = allure_commons.reporter.AllureReporter()
        else:
            # Don't record re-run jobs, since these are just
            # done to get extra log data
            self.reporter = None

        self.test_uuid = None
        self.test_case = None
        pass
コード例 #8
0
def pytest_configure(config):
    report_dir = config.option.allure_report_dir

    test_helper = AllureTestHelper(config)
    # TODO: Why helper is present anyway?
    allure_commons.plugin_manager.register(test_helper)
    config.add_cleanup(cleanup_factory(test_helper))

    if report_dir:
        test_listener = AllureListener(config)
        config.pluginmanager.register(test_listener)
        allure_commons.plugin_manager.register(test_listener)
        config.add_cleanup(cleanup_factory(test_listener))

        file_logger = AllureFileLogger(report_dir)
        allure_commons.plugin_manager.register(file_logger)
        config.add_cleanup(cleanup_factory(file_logger))
コード例 #9
0
 def __init__(self):
     report_root_path = os.path.join(os.getcwd(), "reportsxxxx")
     report_dir_path = os.path.join(
         report_root_path,
         datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))
     if not os.path.isdir(report_dir_path):
         os.makedirs(report_dir_path)
     for f in os.listdir(report_dir_path):
         f = os.path.join(report_dir_path, f)
         if os.path.isfile(f):
             os.unlink(f)
         elif os.path.isdir(f):
             shutil.rmtree(f)
     self.file_logger = AllureFileLogger(report_dir_path)
     allure_commons.plugin_manager.register(self.file_logger)
     self.allure_logger = AllureReporter()
     self.start_at = time.time()
コード例 #10
0
ファイル: plugin.py プロジェクト: Duisus/allure-python
def pytest_configure(config):
    report_dir = config.option.allure_report_dir
    clean = config.option.clean_alluredir

    test_helper = AllureTestHelper(config)
    allure_commons.plugin_manager.register(test_helper)
    config.add_cleanup(cleanup_factory(test_helper))

    if report_dir:
        report_dir = os.path.abspath(report_dir)

        pytest_bdd_listener = PytestBDDListener()
        config.pluginmanager.register(pytest_bdd_listener)
        allure_commons.plugin_manager.register(pytest_bdd_listener)
        config.add_cleanup(cleanup_factory(pytest_bdd_listener))

        file_logger = AllureFileLogger(report_dir, clean)
        allure_commons.plugin_manager.register(file_logger)
        config.add_cleanup(cleanup_factory(file_logger))

        config.addinivalue_line(
            "markers",
            "{mark}: allure link marker".format(mark=ALLURE_LINK_MARK))
コード例 #11
0
def pytest_configure(config):
    report_dir = config.option.allure_report_dir
    clean = config.option.clean_alluredir

    test_helper = AllureTestHelper(config)
    allure_commons.plugin_manager.register(test_helper)
    config.add_cleanup(cleanup_factory(test_helper))

    if report_dir:
        report_dir = os.path.abspath(report_dir)
        test_listener = AllureListener(config)
        config.pluginmanager.register(test_listener)
        allure_commons.plugin_manager.register(test_listener)
        config.add_cleanup(cleanup_factory(test_listener))

        file_logger = AllureFileLogger(report_dir, clean)
        allure_commons.plugin_manager.register(file_logger)
        config.add_cleanup(cleanup_factory(file_logger))

    config.addinivalue_line("markers", "{mark}: allure label marker".format(mark=ALLURE_LABEL_MARK))
    config.addinivalue_line("markers", "{mark}: allure link marker".format(mark=ALLURE_LINK_MARK))
    config.addinivalue_line("markers", "{mark}: allure description".format(mark=ALLURE_DESCRIPTION_MARK))
    config.addinivalue_line("markers", "{mark}: allure description html".format(mark=ALLURE_DESCRIPTION_HTML_MARK))
コード例 #12
0
def pytest_configure(config):

    if CAFY_REPO:
        archive_name = 'allure'
        ARCHIVE = os.path.join(CafyLog.work_dir, archive_name)
        os.environ['ARCHIVE'] = ARCHIVE
        config.option.allure_report_dir = ARCHIVE
        report_dir = config.option.allure_report_dir
    clean = config.option.clean_alluredir

    test_helper = AllureTestHelper(config)
    # TODO: Why helper is present anyway?
    allure_commons.plugin_manager.register(test_helper)
    config.add_cleanup(cleanup_factory(test_helper))

    if report_dir:
        test_listener = AllureListener(config)
        config.pluginmanager.register(test_listener)
        allure_commons.plugin_manager.register(test_listener)
        config.add_cleanup(cleanup_factory(test_listener))

        file_logger = AllureFileLogger(report_dir, clean)
        allure_commons.plugin_manager.register(file_logger)
        config.add_cleanup(cleanup_factory(file_logger))
コード例 #13
0
    def __init__(
            self,
            properties=None,
            versions=[],
            parent_test_suite_name=None,
            auto_generate_parent_test_suite_name=True,
            suite_name=None,
            sub_suite_name=None,
            runner_type=None,
            installer_type=None
    ):
        def generate_suite_name():
            if properties.enterprise:
                edition = "Enterprise"
            else:
                edition = "Community"
            if installer_type:
                package_type = installer_type
            else:
                if ZIP_PACKAGE:
                    package_type = "universal binary archive"
                else:
                    package_type = "deb/rpm/nsis/dmg"
            if len(versions) == 1:
                test_suite_name = """
            ArangoDB v.{} ({}) ({} package) (enc@rest: {}) (SSL: {}) (clean install)
                                """.format(
                    str(versions[0]),
                    edition,
                    package_type,
                    "ON" if properties.encryption_at_rest else "OFF",
                    "ON" if properties.ssl else "OFF"
                )
            else:
                test_suite_name = """
                            ArangoDB v.{} ({}) {} package (upgrade from {}) (enc@rest: {}) (SSL: {})
                            """.format(
                    str(versions[1]),
                    edition,
                    package_type,
                    str(versions[0]),
                    "ON" if properties.encryption_at_rest else "OFF",
                    "ON" if properties.ssl else "OFF",
                )
            if runner_type:
                test_suite_name = "[" + str(runner_type) + "] " + test_suite_name

            return test_suite_name

        test_listeners = [p for p in allure_commons.plugin_manager.get_plugins() if
                          isinstance(p, AllureListener)]
        self.previous_test_listener = None if len(test_listeners) == 0 else test_listeners[0]
        file_loggers = [l for l in allure_commons.plugin_manager.get_plugins() if
                        isinstance(l, AllureFileLogger)]
        self.file_logger = None if len(file_loggers) == 0 else file_loggers[0]

        if self.previous_test_listener:
            self.parent_test_suite_name = self.previous_test_listener.default_parent_test_suite_name
            self.test_suite_name = self.previous_test_listener.default_test_suite_name
        else:
            if suite_name:
                self.test_suite_name = suite_name
            else:
                self.test_suite_name = generate_suite_name()
            if parent_test_suite_name:
                self.parent_test_suite_name = parent_test_suite_name
            elif suite_name and auto_generate_parent_test_suite_name:
                self.parent_test_suite_name = generate_suite_name()
            else:
                self.parent_test_suite_name = None
        self.sub_suite_name=sub_suite_name

        if not self.file_logger:
            if AllureTestSuiteContext.test_suite_count == 0:
                self.file_logger = AllureFileLogger(RESULTS_DIR, CLEAN_DIR)
            else:
                self.file_logger = AllureFileLogger(RESULTS_DIR, False)
            allure_commons.plugin_manager.register(self.file_logger)

        if self.previous_test_listener:
            allure_commons.plugin_manager.unregister(self.previous_test_listener)
        self.test_listener = AllureListener(
            default_test_suite_name=self.test_suite_name,
            default_parent_test_suite_name=self.parent_test_suite_name,
            default_sub_suite_name=self.sub_suite_name,
        )
        allure_commons.plugin_manager.register(self.test_listener)
        self.test_listener.start_suite_container(self.generate_container_name())
        AllureTestSuiteContext.test_suite_count += 1
コード例 #14
0
 def __init__(self, results_path):
     safe_makedirs(results_path)
     self.lifecycle = AllureLifecycle()
     self.logger = AllureFileLogger(results_path)
     self.listener = AllureListener(self.lifecycle)
コード例 #15
0
 def register_allure_plugins(self):
     self.fileLoger = AllureFileLogger("examples")
     self.logger = AllureMemoryLogger()
     plugin_manager.register(self.fileLoger)
     plugin_manager.register(self.listener)
     plugin_manager.register(self.logger)