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

py36+: remove requires_ordered_markup #7838

Merged
merged 1 commit into from Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 0 additions & 22 deletions testing/conftest.py
Expand Up @@ -3,7 +3,6 @@
from typing import List

import pytest
from _pytest.pytester import RunResult
from _pytest.pytester import Testdir

if sys.gettrace():
Expand Down Expand Up @@ -175,27 +174,6 @@ def format_for_rematch(cls, lines: List[str]) -> List[str]:
"""Replace color names for use with LineMatcher.re_match_lines"""
return [line.format(**cls.RE_COLORS) for line in lines]

@classmethod
def requires_ordered_markup(cls, result: RunResult):
"""Should be called if a test expects markup to appear in the output
in the order they were passed, for example:

tw.write(line, bold=True, red=True)

In Python 3.5 there's no guarantee that the generated markup will appear
in the order called, so we do some limited color testing and skip the rest of
the test.
"""
if sys.version_info < (3, 6):
# terminal writer.write accepts keyword arguments, so
# py36+ is required so the markup appears in the expected order
output = result.stdout.str()
assert "test session starts" in output
assert "\x1b[1m" in output
pytest.skip(
"doing limited testing because lacking ordered markup on py35"
)

return ColorMapping


Expand Down
3 changes: 0 additions & 3 deletions testing/test_terminal.py
Expand Up @@ -1017,7 +1017,6 @@ def test_this():
"""
)
result = testdir.runpytest("--color=yes", str(p1))
color_mapping.requires_ordered_markup(result)
result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
[
Expand Down Expand Up @@ -2217,7 +2216,6 @@ def test_foo():
"""
)
result = testdir.runpytest("--color=yes")
color_mapping.requires_ordered_markup(result)
result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
[
Expand All @@ -2237,7 +2235,6 @@ def test_foo():
"""
)
result = testdir.runpytest("--color=yes")
color_mapping.requires_ordered_markup(result)

result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch(
Expand Down