jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
177 stars 28 forks source link

0.11.7: pytest is failing on missing `sphinx_immaterial_pybind11_issue_134` module #299

Closed kloczek closed 3 months ago

kloczek commented 8 months ago

Looks like something is wrong wit test suite. I cannot find sphinx_immaterial_pybind11_issue_134 in source tree

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-immaterial-0.11.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-immaterial-0.11.7-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' --ignore tests/issue_134/issue_134_test.py
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/sphinx-immaterial-0.11.7
configfile: pyproject.toml
testpaths: tests
plugins: snapshot-0.9.0
collected 33 items

tests/cpp_api_parser_test.py ............                                [ 36%]
tests/graphviz_test.py ..                                                [ 42%]
tests/json_domain_test.py ..                                             [ 48%]
tests/nav_adapt_test.py ......                                           [ 66%]
tests/python_apigen_test.py ....F.                                       [ 84%]
tests/python_object_ids_test.py .                                        [ 87%]
tests/python_synopsis_test.py .                                          [ 90%]
tests/python_transform_type_annotations_test.py .                        [ 93%]
tests/search_index_test.py .                                             [ 96%]
tests/system_fonts_test.py .                                             [100%]

=================================== FAILURES ===================================
____________________________ test_pybind11_property ____________________________

apigen_make_app = <function apigen_make_app.<locals>.make at 0x7fd742452a60>

    def test_pybind11_property(apigen_make_app):
        testmod = "sphinx_immaterial_pybind11_issue_134"
        app = apigen_make_app(
            confoverrides=dict(
                python_apigen_modules={
                    testmod: "api/",
                },
            ),
        )
        print(app._status.getvalue())
        print(app._warning.getvalue())

        data = _get_api_data(app.env)

>       options = data.entities[f"{testmod}.Example.is_set_by_init"].options
E       KeyError: 'sphinx_immaterial_pybind11_issue_134.Example.is_set_by_init'

tests/python_apigen_test.py:119: KeyError
----------------------------- Captured stdout call -----------------------------
Running Sphinx v7.1.2

WARNING: Failed to import module sphinx_immaterial_pybind11_issue_134 specified in python_apigen_modules
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-immaterial-0.11.7-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinx_immaterial/apidoc/python/apigen.py", line 1649, in _builder_inited
    importlib.import_module(module_name)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sphinx_immaterial_pybind11_issue_134'

=============================== warnings summary ===============================
tests/graphviz_test.py::test_square_brackets[with]
  /usr/lib64/python3.8/site-packages/pydantic_core/core_schema.py:3921: DeprecationWarning: `FieldValidationInfo` is deprecated, use `ValidationInfo` instead.
    warnings.warn(msg, DeprecationWarning, stacklevel=1)

tests/graphviz_test.py::test_square_brackets[with]
  /usr/lib/python3.8/site-packages/pydantic_extra_types/color.py:240: DeprecationWarning: `general_plain_validator_function` is deprecated, use `with_info_plain_validator_function` instead.
    return core_schema.general_plain_validator_function(

tests/graphviz_test.py::test_square_brackets[with]
  /usr/lib64/python3.8/site-packages/pydantic_core/core_schema.py:3898: DeprecationWarning: `general_plain_validator_function` is deprecated, use `with_info_plain_validator_function` instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/python_apigen_test.py::test_pybind11_property - KeyError: 'sphin...
=================== 1 failed, 32 passed, 3 warnings in 9.39s ===================
2bndy5 commented 8 months ago

You have to first run

pip install -r tests/requirements.txt

This will install the package from source (which is located within the tests folder).

2bndy5 commented 8 months ago

--ignore tests/issue_134/issue_134_test.py

Clearly this isn't the only test that uses the sphinx_immaterial_pybind11_issue_134 package. Your error output indicates that tests/python_apigen_test.py includes a test named test_pybind11_property that relies on this package as well.

kloczek commented 8 months ago

I first time see such thing like installing anything before test from source tree (and I have already packages +12.kl modules as rpm packages). If that module is needed for test suite why it is not located in tests/ tree? 🤔

Looks like everything else is already installed in my build env.

2bndy5 commented 8 months ago

That C-extension module is located within the tests folder, but you have to compile/install it first before running the tests. Thus, my first response on this thread.

I feel like we're starting to repeat the conversation in #242 (which is the reason why I created the tests/README instructions).

kloczek commented 3 months ago

IMO that procedure is a bit to complicated to I've added temporary tests/issue_134/issue_134_test.py to --ignore list. Simple in prod build env I have blocked installing python modules even in build user home directory. How important is that test? 🤔

2bndy5 commented 3 months ago

It literally exists to prevent a regression that was reported in #134 (thus the name).

kloczek commented 3 months ago

OK I'll close this ticket because for now seem it is not per se bug and finding some solution for this failing unit wold be to to complicated. Thank you for your time and expertise 👍 😄 FYI: I've migrated to python 3.9 and latest pytest 8.1.1 and except tis unit everything else is perfectly fine.