Set up pytest

With this change, you can run py.test from the Chromite root, and it
will pass.

Lots of tests are explicitly marked as skipped via pytestmarks. We will
need to address these. Until then, py.test does not replace run_tests.

BUG=chromium:934414
TEST=Run both py.test and run_tests, both inside and outside the chroot.
Outside the chroot, try run_tests with and without pytest installed.
Outside the chroot, expect failures from lib/operation_unittest and
lib/cros_test_lib_unittest; this is consistent with ToT.
With py.test outside the chroot, need to add 'inside_only' to the
excluded markers in pytest.ini. Later, when py.test is run from a
script, or when the runtime env is standardized via venv, this will not
be necessary.

Change-Id: Iee21130b7afd519d264e813974834d301f05bb94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1995734
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Greg Edelston <gredelston@google.com>
Tested-by: Greg Edelston <gredelston@google.com>
diff --git a/scripts/pushimage_unittest.py b/scripts/pushimage_unittest.py
index c218ed7..0f8fe64 100644
--- a/scripts/pushimage_unittest.py
+++ b/scripts/pushimage_unittest.py
@@ -22,6 +22,12 @@
 from chromite.scripts import pushimage
 
 
+# Use our local copy of insns for testing as the main one is not available in
+# the public manifest. Even though _REL is a relative path, this works because
+# os.join leaves absolute paths on the right hand side alone.
+signing.INPUT_INSN_DIR_REL = signing.TEST_INPUT_INSN_DIR
+
+
 class InputInsnsTest(cros_test_lib.MockTestCase):
   """Tests for InputInsns"""
 
@@ -416,13 +422,3 @@
   def testBasic(self):
     """Simple smoke test"""
     pushimage.main(['--board', 'test.board', '/src', '--yes'])
-
-
-def main(_argv):
-  # Use our local copy of insns for testing as the main one is not available in
-  # the public manifest. Even though _REL is a relative path, this works because
-  # os.join leaves absolute paths on the right hand side alone.
-  signing.INPUT_INSN_DIR_REL = signing.TEST_INPUT_INSN_DIR
-
-  # Run the tests.
-  cros_test_lib.main(level='notice', module=__name__)