message: Ensure run_deprecated_v1 only works when tf2 is enabled
diff: @@ -50,6 +50,7 @@ from tensorflow.core.framework import graph_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python import pywrap_tensorflow
  +from tensorflow.python import tf2
  from tensorflow.python.client import device_lib
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  @@ -1026,8 +1027,11 @@ def run_deprecated_v1(func=None):
  raise ValueError("`run_deprecated_v1` only supports test methods.")
  def decorated(self, *args, **kwargs):
  + if tf2.enabled():
  with context.graph_mode():
  f(self, *args, **kwargs)
  + else:
  + f(self, *args, **kwargs)
  return decorated
  