fix: Migrate tests out of src for path protection #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses the other part of Issue #15 mentioned in #15 (comment).
For the benefits of a
src/
directory layout to work the package insidesrc/
needs to be isolated from thetests
, so there should be a top level directory structure like:The reason being that if tests is alongside example_package under src
then when the tests run the version of example_package that will be imported is the code that is currently under
src/example_package
, whatever its current state and not the installed version of the package, which is the thing you want to be testing.Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
The tests are always testing the state of
src/the_well_maintained_test
, regardless of if this is intentional or not, and not able to test the state of any installed code. Here's an example that show this (all commands are run inside of apython:3.9
Docker container):Note that if we intentionally wanted to be testing the local code (e.g. doing a dev workflow of using an editable install) then we hit the
breakpoint()
again as expected and desired👍
What is the new behavior?
Ensuring that the version of the code tested is the installed version and not the state of whatever is in
src/the_well_maintained_test
. You can of course still test the state ofsrc/the_well_maintained_test
with an editable install (which is a very reasonable thing to want to do!) but you also want to make sure that you can test the installed version properly.