message: Fix run_v1_only decorator to make it run only in v1 test cases
diff: @@ -1191,17 +1191,21 @@ def run_v1_only(reason, func=None):
  def decorator(f):
  if tf_inspect.isclass(f):
  - setup = f.__dict__.get("setUp")
  + # To skip an entire test suite class, we only decorate the setUp method
  + # to skip all tests. There are cases when setUp is not defined (not
  + # overridden in subclasses of TestCase, so not available in f.__dict__
  + # below). For those cases, we walk the method resolution order list and
  + # pick the first setUp method we find (usually this should be the one in
  + # the parent class since that's the TestCase class).
  + for cls in type.mro(f):
  + setup = cls.__dict__.get("setUp")
  if setup is not None:
  setattr(f, "setUp", decorator(setup))
  -
  - for name, value in f.__dict__.copy().items():
  - if (callable(value) and
  - name.startswith(unittest.TestLoader.testMethodPrefix)):
  - setattr(f, name, decorator(value))
  + break
  return f
  -
  + else:
  + # If f is just a function, just create a decorator for it and return it
  def decorated(self, *args, **kwargs):
  if tf2.enabled():
  self.skipTest(reason)
  