This is an archive of the discontinued LLVM Phabricator instance.

[test] Allow skipTestIfFn to apply to entire classes for skipIfNoSBHeaders
ClosedPublic

Authored by rupprecht on Nov 16 2022, 9:52 PM.

Details

Summary

Some test cases are already marked @skipIfNoSBHeaders, but they make use of SBAPI headers in test setup. The setup will fail if the headers are missing, so it is too late to wait until the test case to apply the skip annotation.

In addition to allowing this to apply to entire classes, I also changed all the existing annotations from test cases to test classes where necessary/appropriate.

Diff Detail

Event Timeline

rupprecht created this revision.Nov 16 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2022, 9:52 PM
rupprecht requested review of this revision.Nov 16 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2022, 9:52 PM
DavidSpickett accepted this revision.Nov 17 2022, 3:16 AM
DavidSpickett added a subscriber: DavidSpickett.

LGTM. Do what makes sense to you with the comment.

lldb/packages/Python/lldbsuite/test/decorators.py
146

This would make more immediate sense if you added the function prototype as well:

# skipIf(condition, reason)

Or if you can figure a way to do the C++ style skipIf(/*condition=*/reason, reason).

This revision is now accepted and ready to land.Nov 17 2022, 3:16 AM
rupprecht updated this revision to Diff 476137.Nov 17 2022, 8:09 AM
rupprecht marked an inline comment as done.
  • Use named args to indicate reason is used as condition

Thanks!

lldb/packages/Python/lldbsuite/test/decorators.py
146

We can use named args. Both the standardized skipIf [1] and LLDB's fork [2] use the same param names so we should be fine if we ever want to drop our fork and use standard python (I wonder if we should do that?)

I still left the comment because I feel like "condition=reason" is still atypical, but using named args makes it less load-bearing of a comment.

[1] https://docs.python.org/3/library/unittest.html?highlight=skipif#unittest.skipIf
[2] https://github.com/llvm/llvm-project/blob/0dff945bbca9e1c00ac76eafd1af61235272b7dd/lldb/third_party/Python/module/unittest2/unittest2/case.py#L86

This revision was landed with ongoing or failed builds.Nov 17 2022, 8:17 AM
This revision was automatically updated to reflect the committed changes.