Skip to content

feat: include tests in sdist releases #336

Closed

Description

@jkowalleck

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

Activity

  1. added
    enhancement
    on Jan 11, 2023
  2. changed the title [-]feat: include tests in sdist releases[/-] [+]feat: include tests in `sdist` releases[/+] on Jan 11, 2023
  3. jkowalleck commented on Jan 11, 2023

    @jkowalleck
    MemberAuthor

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

  4. added a commit that references this issue on Jan 11, 2023
    079c015
  5. bollwyvl commented on Jan 11, 2023

    @bollwyvl

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

  6. jkowalleck commented on Jan 12, 2023

    @jkowalleck
    MemberAuthor

    @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?

  7. bollwyvl commented on Jan 12, 2023

    @bollwyvl

    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.

  8. jkowalleck commented on Jan 12, 2023

    @jkowalleck
    MemberAuthor

    Sounds reasonable. Will incorporate this patch in our tests.

  9. jkowalleck commented on Jan 12, 2023

    @jkowalleck
    MemberAuthor

    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.

  10. jkowalleck commented on Jan 12, 2023

    @jkowalleck
    MemberAuthor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions