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

Test failures in tests/text_area/test_languages.py #5449

Closed
2 tasks done
eljamm opened this issue Jan 1, 2025 · 5 comments
Closed
2 tasks done

Test failures in tests/text_area/test_languages.py #5449

eljamm opened this issue Jan 1, 2025 · 5 comments

Comments

@eljamm
Copy link

eljamm commented Jan 1, 2025

I'm trying to compile textual 1.0.0 for nixpkgs, but these two tests are failing:

  • tests/text_area/test_languages.py::test_setting_unknown_language
  • tests/text_area/test_languages.py::test_update_highlight_query

Here is the full log:

============================= test session starts ==============================
platform linux -- Python 3.12.8, pytest-8.3.3, pluggy-1.5.0
rootdir: /build/source
configfile: pyproject.toml
testpaths: tests
plugins: aiohttp-1.0.5, asyncio-0.23.8, xdist-3.6.1, syrupy-4.8.0, time-machine-2.15.0
asyncio: mode=Mode.AUTO
12 workers [2751 items]  m
........................................................................ [  2%]
............................................x........................... [  5%]
........................................................................ [  7%]
........................................................................ [ 10%]
........................................................................ [ 13%]
........................................................................ [ 15%]
........................................................................ [ 18%]
........................................................................ [ 20%]
........................................................................ [ 23%]
........................................................................ [ 26%]
........................................................................ [ 28%]
........................................................................ [ 31%]
........................................................................ [ 34%]
........................................................................ [ 36%]
........................................................................ [ 39%]
........................................................................ [ 41%]
......................................x................................. [ 44%]
........................................................................ [ 47%]
........................................................................ [ 49%]
........................................................................ [ 52%]
..............x......................................................... [ 54%]
........................................................................ [ 57%]
........................................................................ [ 60%]
........................................................................ [ 62%]
........................................................................ [ 65%]
........................................................................ [ 68%]
........................................................................ [ 70%]
........................................................................ [ 73%]
........................................................................ [ 75%]
........................................................................ [ 78%]
........................................................................ [ 81%]
..................s..................................................... [ 83%]
.............x.......................................................... [ 86%]
........................................................................ [ 88%]
...............................................F...........F............ [ 91%]
........................................................................ [ 94%]
........................................................................ [ 96%]
........................................................................ [ 99%]
...............                                                          [100%]
=================================== FAILURES ===================================
________________________ test_setting_unknown_language _________________________
[gw7] linux -- Python 3.12.8 /nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/bin/python3.12

    @pytest.mark.syntax
    async def test_setting_unknown_language():
        app = TextAreaApp()
        async with app.run_test():
            text_area = app.query_one(TextArea)

>           with pytest.raises(LanguageDoesNotExist):
E           Failed: DID NOT RAISE <class 'textual.widgets._text_area.LanguageDoesNotExist'>

tests/text_area/test_languages.py:59: Failed
_________________________ test_update_highlight_query __________________________
[gw8] linux -- Python 3.12.8 /nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/bin/python3.12

    @pytest.mark.syntax
    async def test_update_highlight_query():
        app = TextAreaApp()
        async with app.run_test():
            text_area = app.query_one(TextArea)

            # Before registering the language, we have highlights as expected.
>           assert len(text_area._highlights) > 0
E           AssertionError: assert 0 > 0
E            +  where 0 = len(defaultdict(<class 'list'>, {}))
E            +    where defaultdict(<class 'list'>, {}) = TextArea()._highlights

tests/text_area/test_languages.py:89: AssertionError
=============================== warnings summary ===============================
../../nix/store/zx6gfbpzcs60wnbd8d1fd2m7hnim3pvq-python3.12-pytest-8.3.3/lib/python3.12/site-packages/_pytest/config/__init__.py:1441: 13 warnings
  /nix/store/zx6gfbpzcs60wnbd8d1fd2m7hnim3pvq-python3.12-pytest-8.3.3/lib/python3.12/site-packages/_pytest/config/__init__.py:1441: PytestConfigWarning: Unknown config option: asyncio_default_fixture_loop_scope

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

tests/test_reactive.py::test_external_watch_init_does_not_propagate
  /nix/store/01z5nb9glflqqbf4z11m0aiq3jiadk13-python3.12-textual-1.0.0/lib/python3.12/site-packages/textual/css/tokenizer.py:264: RuntimeWarning: coroutine 'test_async_reactive_watch_callbacks_go_on_the_watcher.<locals>.MyApp.callback' was never awaited
    for name, value in zip(expect.names, iter_groups):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/text_area/test_languages.py::test_setting_unknown_language - Failed: DID NOT RAISE <class 'textual.widgets._text_area.LanguageDoesNotExi...
FAILED tests/text_area/test_languages.py::test_update_highlight_query - AssertionError: assert 0 > 0
====== 2 failed, 2744 passed, 1 skipped, 4 xfailed, 14 warnings in 21.11s ======
Copy link

github-actions bot commented Jan 1, 2025

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@TomJGooding
Copy link
Contributor

I'm not familiar with NixOS packages, but are the optional syntax dependencies perhaps not being installed?

From your pytest output above, it looks like you might have disabled a number of tests which maybe included other tests relating to syntax highlighting for this reason...?

@eljamm
Copy link
Author

eljamm commented Jan 2, 2025

You're right, the tests were failing because the dependencies weren't installed.

For textual, we are using py-tree-sitter-languages to provide the grammars, but that project is no longer maintained and its method of loading languages has been deprecated in recent versions of py-tree-sitter. That's why it was marked as broken and wasn't being included in the syntax deps.

As for the skipped tests, we've disabled test_register_language and test_textual_env_var. The former seems to be related to this issue, but I'm not sure about the latter.

That said, looks like we'll need to fix tree-sitter from our part, so thanks a lot for the hint and sorry about the noise.

@eljamm eljamm closed this as completed Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@TomJGooding
Copy link
Contributor

No problem, glad this helped. Textual dropped its dependency on py-tree-sitter-languages for this reason back in v0.89.0 and instead uses separate languages packages if it helps (see #5320).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants