Skip to content

feat: include tests in sdist releases #336

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

Closed
2 tasks done
jkowalleck opened this issue Jan 11, 2023 · 7 comments · Fixed by #337, #338 or #339
Closed
2 tasks done

feat: include tests in sdist releases #336

jkowalleck opened this issue Jan 11, 2023 · 7 comments · Fixed by #337, #338 or #339
Labels
enhancement New feature or request

Comments

@jkowalleck
Copy link
Member

jkowalleck commented Jan 11, 2023

As of #334 (comment)

The one thing that would be useful for downstreams is including the test files in the sdist uploaded to pypy: at present, these are downloaded separately, but sometimes git tags move, github-generated source tarballs change their SHA, etc. Having a single distribution, with a published SHA256, would simplify things a bit, but it's not a huge lift, and worth it to have tests.

sdist releases are - as the name says - source releases, in contrast to egg/wheel/bin releases, so it should be no issue to put the tests next to the sources.

Acceptance criteria:

  • tests are part of the sdist bundle
  • tests are not installed, when the sdist bundle is actually installed via pip or something
@jkowalleck jkowalleck added the enhancement New feature or request label Jan 11, 2023
@jkowalleck jkowalleck changed the title feat: include tests in sdist releases feat: include tests in sdist releases Jan 11, 2023
@jkowalleck
Copy link
Member Author

@bollwyvl does the current ticket description suite your needs?
If not, please help me shape it properly.

jkowalleck added a commit that referenced this issue Jan 11, 2023
fixes #336

Signed-off-by: Jan Kowalleck <[email protected]>
@bollwyvl
Copy link

Yep, that's great. Likely it's a one-liner in e.g. pyproject.toml or (at worst), setup.{cfg,py} and MANIFEST.in.

jkowalleck added a commit that referenced this issue Jan 11, 2023
* feat: include `tests` in `sdist` builds for #336 
* delete unexpected `DS_Store` file

Signed-off-by: Jan Kowalleck <[email protected]>
@jkowalleck jkowalleck reopened this Jan 11, 2023
@jkowalleck
Copy link
Member Author

@bollwyvl

Releases should include the tests in the sdist build, from now on.
I am not certain if the pure tests folder is enough. Please test the latest sdist release and tell me if it was sufficient.

I would expect that you still need to install the test/dev dependencies somehow.
Could you check and confirm everything is as you need it?

@bollwyvl
Copy link

if the pure tests folder is enough

One last missing piece of testing the package as-installed is the expectation of the relative path to the schema content:

==================================== ERRORS ====================================
_____________________ ERROR collecting tests/test_spdx.py ______________________
tests/test_spdx.py:29: in <module>
    with open(path_join(dirname(__file__), '..', 'cyclonedx', 'schema', 'spdx.schema.json')) as spdx_schema:
E   FileNotFoundError: [Errno 2] No such file or directory: '$SRC_DIR/tests/../cyclonedx/schema/spdx.schema.json'
=========================== short test summary info ============================
ERROR tests/test_spdx.py - FileNotFoundError: [Errno 2] No such file or direc...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.47s ===============================

I've added this patch which seems to do the trick, and can do a proper PR if there isn't a whole ceremony around it with CLAs, etc.

Also note (and I believe this is poetry-related, but have forgotten, frankly), but somehow the LICENSE ends up in the root of site-packages/ when installed. We hack around it, and will seldom create a problem for your users: pip will happily, non-deterministically clobber files all day. However, conda (and especially some downstream tooling like constructor) gets real huffy, though.

@jkowalleck
Copy link
Member Author

Sounds reasonable. Will incorporate this patch in our tests.

@jkowalleck
Copy link
Member Author

Also note (and I believe this is poetry-related, but have forgotten, frankly), but somehow the LICENSE ends up in the root of site-packages/ when installed. We hack around it, and will seldom create a problem for your users: pip will happily, non-deterministically clobber files all day. However, conda (and especially some downstream tooling like constructor) gets real huffy, though.

SOrry to hear.
Yes, this is an issue with poetry that I noticed, too.
It was fixed a year ago, now it is back for a while and I gave up on the poor test quality of poetry dev team.
I'll see what I can do.

@jkowalleck
Copy link
Member Author

@bollwyvl ,

Once again, I thank you for helping improve this lib.

The extra LICENSE file and the mentioned path issue should be fixed with the next bug fix release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants