-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
[testing] skip decorators: docs, tests, bugs #7334
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7334 +/- ##
==========================================
- Coverage 80.48% 76.73% -3.76%
==========================================
Files 181 181
Lines 34827 34827
==========================================
- Hits 28032 26724 -1308
- Misses 6795 8103 +1308
Continue to review full report at Codecov.
|
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.
Great, thanks @stas00!
if torch_device != "cuda": | ||
return unittest.skip("test requires CUDA") | ||
return unittest.skip("test requires CUDA")(test_case) |
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.
Nice catch!
* skip decorators: docs, tests, bugs * another important note * style * bloody style * add @pytest.mark.parametrize * add note * no idea what it wants :(
* skip decorators: docs, tests, bugs * another important note * style * bloody style * add @pytest.mark.parametrize * add note * no idea what it wants :(
This reverts commit 75939a5.
This PR:
require_torch_and_cuda
testing.rst
notesOK, so other than a small bug in
require_torch_and_cuda
our skip decorators can be used in any order.The only problem I found so far is when they are used together with
@parameterized
, which has to come first and skip decorators last. It rewrites test names, to create a unique test name for each parameter group. and then it runs them - it has no idea it may have any skip decorators before it (The decorators get all stacked, and one below has no idea what the one above does).If you find other unusual decorators, please let me know and I will investigate.
Partially fixes #7326
@LysandreJik, @sgugger