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

relax tests for old pygments #2851

Merged
merged 1 commit into from
Mar 4, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
relax tests for old pygments
  • Loading branch information
willmcgugan committed Mar 4, 2023
commit 42e1ec915745d55126f3ae0837ce304368b624eb
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