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 cocotb.parameterize() similar to nox.parameterize() #3513
Conversation
AndrewNolte
commented
Nov 16, 2023
- cocotb.parameterize() allows for more idiomatic generation of parameterized tests
- factory.generate_tests() now takes test_dec as an arg, meaning normal test() kwargs are now possible to specify on factory tests
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3513 +/- ##
===========================================
+ Coverage 52.15% 66.54% +14.39%
===========================================
Files 49 49
Lines 8433 8453 +20
Branches 2386 2388 +2
===========================================
+ Hits 4398 5625 +1227
+ Misses 3334 1708 -1626
- Partials 701 1120 +419 ☔ View full report in Codecov by Sentry. |
We haven't discussed raising the required Python version, so it's still 3.6+. I do like this change, I'll try to find some time to review tomorrow. I've been kinda busy recently. |
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.
There is no need to move _create_test
and TestFactory
to decorators.py
If it was left there would be a circular import, regression.py has |
Ah yes. That crap again. There's probably a better way to go about it. If moving |
I don't think this'll work either, because the test() decorator has to check if it's being passed a TestFactory. I think it makes sense to put the Test class and TestFactory class in a separate file, maybe test_types.py? Then decorators.py and regression.py can import from that |
It should be possible now that |
859830e
to
4cc2925
Compare
Nice. It just needs a newsfragment. There's a README in /docs/source/newsfragments/ that details how to do that. Thanks for this! |
@@ -861,8 +941,8 @@ def generate_tests(self, prefix="", postfix=""): | |||
else: | |||
doc += "\t{}: {}\n".format(optname, repr(optvalue)) | |||
|
|||
self.log.debug( | |||
'Adding generated test "%s" to module "%s"' % (name, mod.__name__) | |||
self.log.info( |
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.
Changing the log level is a bit of an unrelated behavioral change which I don't mind but wanted to point out.
I was going to suggest adding a note about this nice functionality to where we describe how to actually use |
Co-authored-by: Colin Marquardt <cmarqu42@gmail.com>
2bcf4e1
to
808890f
Compare