question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom markers don't show custom color in 'short test summary info' section

See original GitHub issue

Discussed in https://github.com/pytest-dev/pytest/discussions/9958

<div type='discussions-op-text'>

Originally posted by jeffwright13 May 14, 2022 At the end of a pytest run, you have a section called “short test summary info,” which terminates in a single line that shows final metrics, all color-coded according to outcome. It doesn’t appear as if this final line uses the custom color to color-code tests that are marked with custom markers. I do see that the initial “test session starts” section does color-code those tests, however.

Am I missing something or is this a deficiency in the final section processing code? I’d like to see that final line show my ‘snowflake’ tests in cyan!

Output: Screen Shot 2022-05-14 at 3 07 36 PM

pytest.ini:

[pytest]
markers =
    snowflake: mark a test as flaky (may pass, may fail)

plugin.py:

def pytest_report_teststatus(report: TestReport, config: Config):
    """Put snowflake tests into a separate group from other failures."""
    if report.when == "call" and 'snowflake' in report.keywords.keys() and report.keywords["snowflake"]:
        return 'snowflake', '❄', ('SNOWFLAKE', {"cyan": True})

test1.py:

def test_aa_ok():
    print("This test doesn't have much to say, but it passes - so OK!!")
    pass

test2.py:

def test_aa_ok():
    print("This test doesn't have much to say, and it fails - not OK!!")
    assert 0

test_snowflake.py:

@pytest.mark.snowflake
def test_snowflake_1():
    assert True


@pytest.mark.snowflake
def test_snowflake_2():
    assert False

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
nicoddemuscommented, Jul 5, 2022

Would that approach also address the lack of coloring in the === short test summary info === section?

This has actually been fixed by #9875 and will be available in pytest 7.2.

1reaction
RonnyPfannschmidtcommented, Jun 9, 2022

@nicoddemus bascially i want to pass the markup that was added in that hook into the status collection as well,

that way we can use the color markup we already use in multiple places (the character and the word) in the summary as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pytest – How to Run Tests Efficiently - Finxter
Pytest captures the output and shows it in the summary info section, ... You can define your custom markers and use them to...
Read more >
Google Maps API v3: custom markers not clickable on mobile ...
I've narrowed it down to our custom markers. If I remove the code that loads our custom marker images using new google.maps.MarkerImage() ,...
Read more >
Working with custom markers — pytest documentation
Node IDs for failing tests are displayed in the test summary info when running pytest with the -rf option. You can also construct...
Read more >
Markers | Maps SDK for Android - Google Developers
Markers indicate single locations on the map. You can customize your markers by changing the default color, or replacing the marker icon with...
Read more >
Registering Custom Markers in PyTest - Numpy Ninja
When using custom markers in PyTest we need to register them before using. Let's see how. New to Pytest check ... short test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found