scripts: run_tests: only cache tools once

No need to try to cache the networking tools twice -- once before we
re-exec, and once after.  The cache should be fully populated then,
and we don't want to waste time on checking hashes.

BUG=None
TEST=`./run_tests` shows it updating caches only once

Change-Id: I1dd4c54aa73685efe3ad6644b9b0883b80ec69cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4381960
Commit-Queue: Lizzy Presland <zland@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Lizzy Presland <zland@google.com>
diff --git a/scripts/run_tests.py b/scripts/run_tests.py
index 8839ad9..5181850 100644
--- a/scripts/run_tests.py
+++ b/scripts/run_tests.py
@@ -58,7 +58,8 @@
     if opts.network:
         pytest_args += ["-m", "not network_test or network_test"]
 
-    precache()
+    if opts.precache:
+        precache()
 
     if opts.quick:
         logging.info("Skipping test namespacing due to --quickstart.")
@@ -67,7 +68,7 @@
         # interfere with parts of the running system if not isolated in a namespace.
         # Disabling namespaces is not recommended for general use.
         namespaces.ReExecuteWithNamespace(
-            [sys.argv[0]] + argv, network=opts.network
+            [sys.argv[0], "--no-precache"] + argv, network=opts.network
         )
 
     jobs = opts.jobs
@@ -176,6 +177,12 @@
         help="Include network tests.",
     )
     parser.add_argument(
+        "--no-precache",
+        dest="precache",
+        action="store_false",
+        help="Skip precaching packages from the network.",
+    )
+    parser.add_argument(
         "--no-chroot",
         dest="chroot",
         action="store_false",