test: project scope fixtures for repo root and data dir#572
Open
aaraney wants to merge 2 commits intoNOAA-OWP:masterfrom
Open
test: project scope fixtures for repo root and data dir#572aaraney wants to merge 2 commits intoNOAA-OWP:masterfrom
aaraney wants to merge 2 commits intoNOAA-OWP:masterfrom
Conversation
5a53d47 to
7168ca2
Compare
Member
Author
|
reworded the commit. |
Contributor
|
Any chance you can make a semi-bs/unnecessary fixture and refactor a low stakes unit test implementation to use it for a more concrete example? Or I guess add a new unit test that tests something super small as a rough example for those not in the know and don't know what 'read the manual' means? |
Member
Author
Contributor
|
I absolutely love it. I'd go ahead and merge it if the unit test didn't whine about not knowing what pytest was. Maybe that needs to work itself into the requirements.txt or something. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a proof of concept solution to #570. For this to work, this will require running tests with
pytest. In short, this exposes the repo root and data directory paths aspytestfixtures that can be utilized bypyteststyle tests andunittest.UnitTesttests. Theunittestfixture variants set private properties onunittest.UnitTestinstances.Example of adding this functionality to a
unittest.UnitTest:For those who have not been indoctrinated, here are a few links that will be helpful to understand
pytests integration withunittest, the concept of a fixture, and fixture scopes.edit: fixed link to the description / diagram of fixture scopes