xref: /aosp_15_r20/external/cronet/build/android/pylib/base/test_instance.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2014 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6class TestInstance:
7  """A type of test.
8
9  This is expected to handle all logic that is test-type specific but
10  independent of the environment or device.
11
12  Examples include:
13    - gtests
14    - instrumentation tests
15  """
16
17  def __init__(self):
18    pass
19
20  def TestType(self):
21    raise NotImplementedError
22
23  # pylint: disable=no-self-use
24  def GetPreferredAbis(self):
25    return None
26
27  # pylint: enable=no-self-use
28
29  def SetUp(self):
30    raise NotImplementedError
31
32  def TearDown(self):
33    raise NotImplementedError
34
35  def __enter__(self):
36    self.SetUp()
37    return self
38
39  def __exit__(self, _exc_type, _exc_val, _exc_tb):
40    self.TearDown()
41