Skip to content

Include tests in source distribution #8

@bcbnz

Description

@bcbnz

When building from a source distribution (e.g., when creating a system package) it is preferable to run the tests on the built code. This requires the tests to be included in the source distribution.

I haven't used poetry before, but I had a play with it and couldn't find a nice way to include them:

  • You can use packages = [{ include = "quaternion" }, { include = "tests", format = "sdist" }] in the [tool.poetry] section of pyproject.toml which includes the tests directory in the source distribution, but treats it as another package, i.e., the generated setup.py would also install the tests as a package, which is certainly not ideal.

  • Add support of inline tables in include on pyproject.toml. python-poetry/poetry-core#6 adds similar format= filtering to includes; it has been accepted but doesn't seem to have been released yet (at least, the Poetry version 1.0.10 I have installed doesn't support it). I think this will allow something like include = [{path = "tests/*", format = "sdist"}] once its available.

For now, the archive generated by GitHub is sufficient, but once there is sufficient poetry support it would be nice to have the tests in all source distributions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions