Skip to content
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

Make extras available within the plugin #10

Open
Stefanhg opened this issue Dec 5, 2023 · 1 comment
Open

Make extras available within the plugin #10

Stefanhg opened this issue Dec 5, 2023 · 1 comment

Comments

@Stefanhg
Copy link

Stefanhg commented Dec 5, 2023

Hello,

I think it would be a good idea to make the "extras" list available in the plugin and the needed pytest_runtest_makereport hook also. This would make it much easier to work with instead of having to add additional code in your project in order to support extras.
Example:

import pytest
EXTRAS = []

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    report = outcome.get_result()
    if report.when == 'call':
        report.extra = EXTRAS

Instead could be replaced with both a fixture for adding extras and the actual list just like pytest_html has support for.

examples:

def test_extras(extra):
     extra.append(
     {
        "name": "Text",
        "format": "text",
        "content": "<lorem ipsum> " * 100,
    })
from pytest_reporter import extras

def test_extras():
     extra.append(
     {
        "name": "Text",
        "format": "text",
        "content": "<lorem ipsum> " * 100,
    })
@christiansandberg
Copy link
Owner

I actually misspelled extras without an s. It was meant for compatibility with pytest-html so with next release you can use the pytest-html plugin to do that. Although it would be nice to be able to add extras without installing an additional plugin.

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

No branches or pull requests

2 participants