Skip to content

Commit

Permalink
Merge pull request #2851 from Textualize/relax-pygments
Browse files Browse the repository at this point in the history
relax tests for old pygments
  • Loading branch information
willmcgugan committed Mar 4, 2023
2 parents e897cd3 + 42e1ec9 commit fa09487
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include = ["rich/py.typed"]
[tool.poetry.dependencies]
python = ">=3.7.0"
typing-extensions = { version = ">=4.0.0, <5.0", python = "<3.9" }
pygments = "^2.14.0"
pygments = "^2.13.0"
ipywidgets = { version = ">=7.5.1,<9", optional = true }
markdown-it-py = "^2.2.0"

Expand Down
6 changes: 6 additions & 0 deletions tests/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import tempfile

import pkg_resources
import pytest
from pygments.lexers import PythonLexer

Expand All @@ -20,6 +21,9 @@

from .render import render

PYGMENTS_VERSION = pkg_resources.get_distribution("pygments").version
OLD_PYGMENTS = PYGMENTS_VERSION == "2.13.0"

CODE = '''\
def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
"""Iterate and generate a tuple with a flag for first and last value."""
Expand Down Expand Up @@ -98,6 +102,7 @@ def test_python_render_simple_passing_lexer_instance():
assert rendered_syntax == expected


@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer")
def test_python_render_simple_indent_guides():
syntax = Syntax(
CODE,
Expand All @@ -114,6 +119,7 @@ def test_python_render_simple_indent_guides():
assert rendered_syntax == expected


@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer")
def test_python_render_line_range_indent_guides():
syntax = Syntax(
CODE,
Expand Down

0 comments on commit fa09487

Please sign in to comment.