[all-commits] [llvm/llvm-project] 212a60: [lldb][test] Remove `self` references from decorat...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Wed Nov 15 17:51:38 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 212a60ec37322f853e91e171b305479b1abff2f2
      https://github.com/llvm/llvm-project/commit/212a60ec37322f853e91e171b305479b1abff2f2
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2023-11-15 (Wed, 15 Nov 2023)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/decorators.py
    M lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
    M lldb/packages/Python/lldbsuite/test/lldbtest.py

  Log Message:
  -----------
  [lldb][test] Remove `self` references from decorators (#72416)

This is partial step toward removing the vendored `unittest2` dep in
favor of the `unittest` library in standard python. One of the large
differences is when xfail decorators are evaluated. With the `unittest2`
vendored dep, this can happen at the moment of calling the test case,
and with LLDB's decorator wrappers, we are passed the test class in the
decorator arg. With the `unittest` framework, this is determined much
earlier; we cannot decide when the test is about to start that we need
to xfail.

Fortunately, almost none of these checks require any state that can't be
determined statically. For this patch, I moved the impl for all the
checks to `lldbplatformutil` and pointed the decorators to that,
removing as many `self` (i.e. test class object) references as possible.
I left wrappers within `TestBase` that forward to `lldbplatformutil` for
convenience, but we should probably remove those later.

The remaining check that can't be moved statically is the check for the
debug info type (e.g. to xfail only for dwarf). Fixing that requires a
different approach, so I will postpone that to the next patch.




More information about the All-commits mailing list