python-package-guide icon indicating copy to clipboard operation
python-package-guide copied to clipboard

Test examples

Open jrrickerson opened this issue 8 months ago • 1 comments

Begin work on #249 (and #248 to some degree) by adding a few Pytest-based unit tests to the "pure-hatch" example code. I added some dummy data to use to test the actual "mean" calculations, since I thought a more complex mocking / faking example would probably be out of scope.

Moving forward, I'd like to add the tests to CI and add nox tests for the actual packaging steps.

As this is my first PR for the project, please let me know anything I might need to clean up!

jrrickerson avatar May 21 '25 15:05 jrrickerson

Summoning @lwasser: I thought we had recommended importlib.resources for exactly this scenario: 5kb of CSV files are used in testing. But our tests page Only recommends a "repository such as Figshare or Zenodo" and then using Pooch. But that seems like over kill for cases such as this. And although the package here is artificial, I don't think this case is very unusual.

ucodery avatar May 21 '25 22:05 ucodery

Summoning @lwasser: I thought we had recommended importlib.resources for exactly this scenario: 5kb of CSV files are used in testing. But our tests page Only recommends a "repository such as Figshare or Zenodo" and then using Pooch. But that seems like over kill for cases such as this. And although the package here is artificial, I don't think this case is very unusual.

Summoned 🧞‍♀️ 😆 hi! So the data section of our guide needs some real work - there is a pr here that we can work on together. What i suggest here @ucodery is that if you think importlib.resources is the best approach, let's use it

then let's open an issue to update the tests page to reference that. And then let's work on that data pr that @NickleDave started to get it merged in the upcoming months (maybe by the end of SciPy even!)

Does that sound reasonable to you? I trust your thoughts on best ways to include data in packages.

lwasser avatar May 28 '25 16:05 lwasser