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

Include tests in source distribution #8

Closed
bcbnz opened this issue Sep 5, 2020 · 4 comments
Closed

Include tests in source distribution #8

bcbnz opened this issue Sep 5, 2020 · 4 comments

Comments

@bcbnz
Copy link
Contributor

bcbnz commented Sep 5, 2020

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.

@moble
Copy link
Owner

moble commented Sep 5, 2020

Just a plain old

[tool.poetry]
include = ["tests"]

seems to do the trick on my version. I'll give it a shot...

moble added a commit that referenced this issue Sep 5, 2020
@bcbnz
Copy link
Contributor Author

bcbnz commented Sep 5, 2020

The only potential problem is that (on my version anyway) that also copies the tests into the wheel at the top level, and I'm not sure if that's desirable.

@moble moble closed this as completed in b0cee9b Sep 5, 2020
@moble
Copy link
Owner

moble commented Sep 5, 2020

It's not showing up in the wheel for me. I'm on the preview release here, and in the CI. So it shouldn't be a problem, but I'll check once it makes it to PyPI to make sure.

@moble
Copy link
Owner

moble commented Sep 5, 2020

I've verified that the newest wheel on PyPI isn't getting the tests included.

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