goodpractices - needs __init__.py for easy invocation#4616
Conversation
The tests folder must be a package in order to simply run `pytest` and for it to simply work, as the docs imply. Without this, pytest does not add the current directory to PYTHONPATH, and so seems to mysteriously fail.
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
In this example its intentionally left out
Codecov Report
@@ Coverage Diff @@
## master #4616 +/- ##
==========================================
- Coverage 95.75% 95.74% -0.02%
==========================================
Files 111 111
Lines 24678 24678
Branches 2446 2446
==========================================
- Hits 23630 23627 -3
Misses 740 740
- Partials 308 311 +3
Continue to review full report at Codecov.
|
|
Yep, there's an example which uses proper test packages in that page as well. But thanks anyway for the PR, we appreciate it! |
|
@nicoddemus Thanks! Just so you know, I spent some time choosing the layout that best applied to my case. The text accompanying the version with When The intent isn't to give a broken recipe, is it? Or, if that version of the layout is legit, can I update this PR to add a working |
|
@dogweather the main reason is that adding a the general suggestion is to use a installed version, or a editable installed version of the package to test against ( |
|
@dogweather thanks for the explanation. You hit a wall that is very common, because it is recommended in general to test against an installed version of your library or an editable install ( For the cases where the user just has a small module and no Perhaps we can add the |
|
More information: https://docs.pytest.org/en/latest/pythonpath.html |
|
Hmmm we should probably also add in |
The tests folder must be a package in order to simply run
pytestand for it to simply work, as the docs imply. Without this, pytest does not add the current directory to PYTHONPATH, and so seems to mysteriously fail.Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is
just a guideline):
changelogfolder, with a name like<ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.masterbranch for bug fixes, documentation updates and trivial changes.featuresbranch for new features and removals/deprecations.Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
AUTHORSin alphabetical order;