Skip to content

sdist is incomplete for tests: test_meson_python_file_handling assumes missing packages/ workspace #452

Closed

Description

@mcepl

Hi,
while packaging griffe 2.0.2 for openSUSE, the test suite fails when run from the PyPI source tarball (sdist), even though most of the suite passes.

The failing test is:

  • tests/test_finder.py::test_meson_python_file_handling

Failure:

FileNotFoundError: [Errno 2] No such file or directory: 'packages/griffelib/src'
From the test:
pth_file.write_text(
    "hello=1\ninstall({'griffe', 'hello'}, 'packages/griffelib', ['/tmp/ninja'], False)",
    encoding="utf8",
)
...
assert paths == [Path("packages/griffelib/src")]

The problem seems to be that the test assumes a repository/workspace checkout layout where packages/griffelib/src exists. However, in the published sdist, the packages/ directory is not included.

Relevant pyproject.toml bits:

  • the sdist include list does not include /packages
  • but the project still defines a workspace with members = ["packages/*"]

So either:

  1. the sdist should include the packages/ tree needed by the tests, or
  2. this test should not assume checkout-only paths when run from an sdist

In downstream packaging, we currently have to skip this single test when testing from the released tarball.
Would you prefer a patch to the test, or should the sdist contents be adjusted?

Activity

  1. added
    unconfirmed
    on Apr 14, 2026
  2. pawamoy commented on Apr 14, 2026

    @pawamoy
    Member

    Thanks for the report @mcepl!

    We can either include packages/ in the sdist, or consider that no tests should run for the griffe meta-package, since it doesn't contain code and only depends on griffelib and griffecli.

    By the way, do you also package griffelib and griffecli separately? If so, I don't think we include tests in the sdists for those: do you use the tests from the Git repository? Or do you use no tests at all?

    This project architecture is quite new for me (monorepo), so I'm not sure how people usually deal with OS-packaging.

  3. added
    packaging
    tests
    and removed
    unconfirmed
    on Apr 14, 2026
  4. mcepl commented on Apr 14, 2026

    @mcepl
    Author

    By the way, do you also package griffelib and griffecli separately? If so, I don't think we include tests in the sdists for those: do you use the tests from the Git repository? Or do you use no tests at all?

    Yes, we do:

    And yes, griffecli and griffelib don’t run any tests. I should fix that (and if you packaged tests to the tarball as well, it would be appreciated).

  5. pawamoy commented on Apr 15, 2026

    @pawamoy
    Member

    Thank you! So, I suggest we add tests and all other necessary files to the sdists for griffelib and griffecli, and leave the griffe sdist empty. Tests should run against griffelib and griffecli, and not against griffe (this would be redundant). To avoid running tests for griffecli when testing griffelib, and inversely, I'll add pytest markers to all tests, so you can pass the right markers to filter tests. Or maybe I can try splitting the test suite in two, but it might be a bit more difficult. WDYT?

    @johnslavik interested in your opinion too!

  6. mcepl commented on Apr 16, 2026

    @mcepl
    Author

    WDYT?

    Big +1 from me!

  7. pawamoy commented on Jun 19, 2026

    @pawamoy
    Member

    Done in #464, next published sdists should have tests included, except for the meta distribution griffe:

    • griffe: meta-distribution, depending on griffecli and griffelib, no tests
    • griffecli: CLI package, depending on griffelib, tests for the CLI only
    • griffelib: library providing the griffe package, no deps, tests for the library

    Let me know if you have trouble with specific tests and I'll add some @skipif markers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

packagingtests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions