New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add information from tests to ward fixtures
#161
Conversation
Thanks for this, and sorry for the delay. Will hopefully be able to give a first review this week. |
An initial finding after checking out the branch and running These fixtures are actually used by tests, but the tests themselves are parameterised.
|
Ok, I think I got the parameterisation down. I introduced a new layer in the argument resolver, One thing I noticed is that the search-like things still only effect test collection, not fixture collection, because I'm comparing against the defined fixtures. This may produce pretty unexpected results, because you put in a search, and it'll suddenly tell you that a bunch of your fixtures from modules that you may have explicitly excluded from the search are unused. Thoughts on how to approach that? Applying the same criteria to both doesn't quite seem right. My instinct is that the fixtures command should always look at all tests, and the searches should apply to the fixtures, not the tests. (I think you may have indicated that that was your desired behavior in #154 but it went over my head at the time.) |
I agree with your instincts: I think the search should just apply to fixtures instead of tests. I think it's still useful to be able to limit by paths though, where the fixtures listed are only those that lie within the specified paths. e.g. show me the usage of all fixtures defined in my It does raise another question as to how I'll try and have a look at the latest changes over the weekend, thanks! :) |
So, I took the coward's way out and used a new argument
That being said, I think it makes a lot of sense to have a config subsection for each subcommand. Idle thought: what if fixtures could have tags as well, and those tags would be propagated to their descendants? A slow fixture marks all of the tests that depend on it as slow, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I've just requested a few small changes in my review.
Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## master #161 +/- ##
==========================================
+ Coverage 72.94% 73.27% +0.33%
==========================================
Files 16 16
Lines 1349 1452 +103
Branches 243 263 +20
==========================================
+ Hits 984 1064 +80
- Misses 318 341 +23
Partials 47 47
Continue to review full report at Codecov.
|
Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
# Conflicts: # ward/tests/test_fixtures.py # ward/tests/test_testing.py
… name for that function)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes, and sorry for the wait! 🏖️
No worries! 😄 |
So, this turned into a doozy. I think it's ready for a round of review.
Addresses #159
Test
andFixture
are now hashable. This was a little tricky forFixture
, since it seems like the underlying function's hash is different in different places (I suspect this is because they aren't actually the same function when inside theSuite
because of assertion rewriting?).Test
now has a helper class,TestArgumentResolver
, where are all of the methods that make that happen are stored. I actually didn't really need to modify them at all, although I changed how information flows through them a little and added a helper method to get fixture arguments. This made the rest of the logic a little easier for me to grok and provides an obvious place to hang more code in the future. More data could be passed to the resolver directly to lessen the amount ofself.test.<whatever>
going on in it.ward fixtures
can now display three kinds of dependency information: parent fixtures, child fixtures, and direct test usages. Parents and children can be displayed as trees.