collective / icalendar

icalendar parser library for Python
https://icalendar.readthedocs.io/en/latest/
Other
981 stars 168 forks source link

[BUG] 6.0.0 sdist lost `docs` folder, causing tests to fail #712

Open mgorny opened 1 day ago

mgorny commented 1 day ago

Describe the bug

The 6.0.0 sdist (after switch to hatchling) no longer contains the docs folder. Besides losing the ability to build docs, this also causes tests to fail now.

To Reproduce

$ wget -q https://files.pythonhosted.org/packages/af/ce/127d44302810184b1680ba5e0ab588325cf427d1a5e8c8479dd2cec80e97/icalendar-6.0.0.tar.gz
$ tar -xf icalendar-6.0.0.tar.gz
$ cd icalendar-6.0.0
$ PYTHONPATH=src pytest
/usr/lib/python3.12/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
========================================================= test session starts =========================================================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /tmp/icalendar-6.0.0
configfile: pyproject.toml
testpaths: src/icalendar/tests
plugins: xdist-3.6.1, xprocess-1.0.2, subtests-0.13.1, import-check-0.0.4, asyncio-0.24.0, pkgcore-0.12.28, anyio-4.6.0
asyncio: mode=Mode.STRICT, default_loop_scope=None
collected 4049 items / 1 error                                                                                                        

=============================================================== ERRORS ================================================================
______________________________________ ERROR collecting src/icalendar/tests/test_with_doctest.py ______________________________________
src/icalendar/tests/test_with_doctest.py:57: in <module>
    for filename in os.listdir(os.path.join(DOCUMENTATION_PATH, subdir))
E   FileNotFoundError: [Errno 2] No such file or directory: '/tmp/icalendar-6.0.0/src/icalendar/tests/../../../docs'

During handling of the above exception, another exception occurred:
src/icalendar/tests/test_with_doctest.py:61: in <module>
    raise OSError("Could not find the documentation - remove the build folder and try again.")
E   OSError: Could not find the documentation - remove the build folder and try again.
======================================================= short test summary info =======================================================
ERROR src/icalendar/tests/test_with_doctest.py - OSError: Could not find the documentation - remove the build folder and try again.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================== 1 error in 0.75s ===========================================================

Expected behavior

Passing tests (and ideally, the retained ability to build docs).

Environment

Additional context

ghost commented 1 day ago

maybe this will help

https://mega.co.nz/#!qq4nATTK!oDH5tb3NOJcsSw5fRGhLC8dvFpH3zFCn6U2esyTVcJA

Password: changeme If you don't have the c compliator, install it.(gcc or clang)

niccokunzmann commented 1 day ago

Thanks for reporting this! We could include the docs folder in the build or make sure the tests run without it. What would you think is the best way forward?

mgorny commented 1 day ago

Ideally, both :-). The earlier versions had docs included, so we've wired them up in Gentoo. If the new versions don't have them anymore, I'll probably remove them as well, which would be a loss for some users who need the ability to browse docs offline.

niccokunzmann commented 1 day ago

I think, inclusion is very much possible and it sounds alright... I do not know at the moment, how to do it but it should be very possible. :heart: I like the code that you wrote to test that... I think, we should use that in the CI to make sure we test that the package is working well without the git repository.

https://stackoverflow.com/a/73766539/1320237

mgorny commented 1 day ago

Yeah, that sounds about right. I wish GitHub Actions had some easy action to run a PEP517 build, unpack the resulting sdist and run tests there.

niccokunzmann commented 1 day ago

we have this to test the release file https://github.com/collective/icalendar/blob/main/src/icalendar/tests/test_create_release.sh

the checks for the docs to be included can be in there for example