-
Notifications
You must be signed in to change notification settings - Fork 53
Add CLI command to show fixture information #154
Conversation
This looks fantastic! Thanks so much Josh 🙂 I'll try to review it ASAP! |
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.
What happens in the case a fixture depends on a fixture which depends on a fixture?
I've put some initial comments/suggestions. Let me know what you think 😄
Co-Authored-By: Darren Burns <darrenburns@users.noreply.github.com>
… information into a "fixtures" subcommand. Currently broken by pallets/click#430 (but might be resolved by pallets/click#1540)
So it turns out the cleanest way to effectively alias |
Would https://github.com/click-contrib/click-default-group not be an option for this? Also marks the default command in the help. |
If it's alright to add the dependency, that would certainly work. |
I wouldn't be against adding that dependency (but the alias is a pretty minor thing IMO.) |
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.
This is fantastic. I made a couple of very small text changes/updates but looks good 👍 !
(I was up too late and decided to take a crack at #151 ; apologies for not poking that issue in advance. This is my first time looking at Ward, so please let me know if this implementation is just bogus given other design considerations!)
This PR adds a CLI option
--fixtures
that a) prevents tests from executing at all (it does not even print them like in a dry run) and b) prints out information on all defined fixtures. The output from ward's own suite looks like this (I took the liberty of turning an unrelated comment in a fixture into a docstring to show what it would look like):The simplest way to wire this up was to store off fixture functions to a module-level list in every invocation of the
fixture
decorator. This goes against the "don't look at fixtures until we run tests" note in #151 . However, it could enable other run options where Ward does this collection step, then runs the tests and print out more annotations on the fixtures, namely which/how many tests actually used them. I see some value in this kind of lightweight introspection to identify all defined fixtures, regardless of whether they're used or not (and it still obeys the less-strict statement "only look at fixtures that are imported by the test suite").No tests yet, because I wasn't sure how you would want this kind of CLI output tested.