Skip to content

Support remote allure server within allure logger #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

niraradness
Copy link

@niraradness niraradness commented Apr 13, 2023

//: # (
. Thank you so much for sending us a pull request!
.
. Make sure you have a clear name for your pull request.
. The name should start with a capital letter and no dot is required in the end of the sentence.
. To link the request with isses use the following notation: (fixes #123, fixes #321)
.
. An example of good pull request names:
. - Add Russian translation (fixes #123)
. - Add an ability to disable default plugins
. - Support emoji in test descriptions
)

Context

Checklist

pytest_configure - Registering http logger based on config.option
Clearing results list after sending to remote server
@CLAassistant
Copy link

CLAassistant commented Apr 13, 2023

CLA assistant check
All committers have signed the CLA.

@niraradness niraradness changed the title Http allure logger Support remote allure server within allure logger Apr 13, 2023
@delatrie
Copy link
Contributor

Hi, @niraradness! Thank you for contributing to allure-python. Unfortunately, I have to close it.

Sending allure results to a 3rd party remote server is out of the scope of Allure integrations with test frameworks. If you need it, you may define a listener in your own code (in conftest.py):

from allure_commons import hookimpl
from allure_commons import plugin_manager


class MyLogger:
    @hookimpl
    def report_result(self, result):
        ... # handle a test result

    @hookimpl
    def report_container(self, container):
        ... # handle a container

    @hookimpl
    def report_attached_file(self, source, file_name):
        ... # handle an attachment file

    @hookimpl
    def report_attached_data(self, body, file_name):
        ... # handle attachment content

    def close(self):
        ... # cleanup the resources here


def pytest_configure(config):

    def cleanup():
        name = plugin_manager.get_name(my_logger)
        plugin_manager.unregister(name=name)
        my_logger.close()

    my_logger = MyLogger()
    plugin_manager.register(my_logger)
    config.add_cleanup(cleanup)

If you would like to discuss the topic further or need help implementing things like that, I invite you to open a new discussion here.

@delatrie delatrie closed this Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for behave which is running on parallel mode - now allure-results directory is creating empty. Fail to load allure plugin with pytest-3.2.0
3 participants