py36+: remove requires_ordered_markup

This commit is contained in:
Anthony Sottile 2020-10-02 13:23:41 -07:00
parent 325b988ca8
commit daba7ceb71
2 changed files with 0 additions and 25 deletions

View File

@ -3,7 +3,6 @@ import sys
from typing import List from typing import List
import pytest import pytest
from _pytest.pytester import RunResult
from _pytest.pytester import Testdir from _pytest.pytester import Testdir
if sys.gettrace(): if sys.gettrace():
@ -175,27 +174,6 @@ def color_mapping():
"""Replace color names for use with LineMatcher.re_match_lines""" """Replace color names for use with LineMatcher.re_match_lines"""
return [line.format(**cls.RE_COLORS) for line in 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 return ColorMapping

View File

@ -1017,7 +1017,6 @@ def test_color_yes(testdir, color_mapping):
""" """
) )
result = testdir.runpytest("--color=yes", str(p1)) result = testdir.runpytest("--color=yes", str(p1))
color_mapping.requires_ordered_markup(result)
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch( color_mapping.format_for_fnmatch(
[ [
@ -2217,7 +2216,6 @@ class TestCodeHighlight:
""" """
) )
result = testdir.runpytest("--color=yes") result = testdir.runpytest("--color=yes")
color_mapping.requires_ordered_markup(result)
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch( color_mapping.format_for_fnmatch(
[ [
@ -2237,7 +2235,6 @@ class TestCodeHighlight:
""" """
) )
result = testdir.runpytest("--color=yes") result = testdir.runpytest("--color=yes")
color_mapping.requires_ordered_markup(result)
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
color_mapping.format_for_fnmatch( color_mapping.format_for_fnmatch(