Skip to content

Commit

Permalink
Merge pull request #1904 from mgorny/lexer-name-fix
Browse files Browse the repository at this point in the history
PyPy3 test fixes
  • Loading branch information
willmcgugan committed Feb 9, 2022
2 parents 972dedf + f15dc3e commit 5fafb92
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed performance issue in measuring text

### Fixed

- Fixed test failures on PyPy3 https://github.com/Textualize/rich/pull/1904

## [11.1.0] - 2022-01-28

### Added
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -28,3 +28,4 @@ The following people have contributed to the development of Rich:
- [Nicolas Simonds](https://github.com/0xDEC0DE)
- [Gabriele N. Tornetta](https://github.com/p403n1x87)
- [Patrick Arminio](https://github.com/patrick91)
- [Michał Górny](https://github.com/mgorny)
9 changes: 9 additions & 0 deletions tests/test_inspect.py
Expand Up @@ -32,6 +32,11 @@
reason="rendered differently on py3.10",
)

skip_pypy3 = pytest.mark.skipif(
hasattr(sys, "pypy_version_info"),
reason="rendered differently on pypy3",
)


def render(obj, methods=False, value=False, width=50) -> str:
console = Console(file=io.StringIO(), width=width, legacy_windows=False)
Expand Down Expand Up @@ -81,6 +86,7 @@ def test_render():
assert expected == result


@skip_pypy3
def test_inspect_text():
expected = (
"╭──────────────── <class 'str'> ─────────────────╮\n"
Expand All @@ -98,6 +104,7 @@ def test_inspect_text():

@skip_py36
@skip_py37
@skip_pypy3
def test_inspect_empty_dict():
expected = (
"╭──────────────── <class 'dict'> ────────────────╮\n"
Expand All @@ -119,6 +126,7 @@ def test_inspect_empty_dict():
assert render({}).startswith(expected)


@skip_pypy3
def test_inspect_builtin_function():
expected = (
"╭────────── <built-in function print> ───────────╮\n"
Expand Down Expand Up @@ -237,6 +245,7 @@ def test_inspect_integer_with_methods():

@skip_py36
@skip_py37
@skip_pypy3
def test_broken_call_attr():
class NotCallable:
__call__ = 5 # Passes callable() but isn't really callable
Expand Down
2 changes: 1 addition & 1 deletion tests/test_syntax.py
Expand Up @@ -277,7 +277,7 @@ def test_from_path_lexer_override():
try:
os.write(fh, b"import this\n")
syntax = Syntax.from_path(path, lexer="rust")
assert syntax.lexer.name is "Rust"
assert syntax.lexer.name == "Rust"
assert syntax.code == "import this\n"
finally:
os.remove(path)
Expand Down

0 comments on commit 5fafb92

Please sign in to comment.