lib: move environment setting in cros_test_lib.TestCase to conftest.py

This ensures that pytest tests get the same environment, and also that
pytest tests that _set_ environment variables no longer have them
leaking into other test cases.

Follow-up to https://crrev.com/c/4617263/comment/444a85fc_5cc57e6f/

BUG=None
TEST=run_tests

Change-Id: Id4176dcc60b88b2b435490f8c6bf124360aadfc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4750603
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Trent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
diff --git a/scripts/build_sdk_subtools_unittest.py b/scripts/build_sdk_subtools_unittest.py
index 4c346e5..70922bd 100644
--- a/scripts/build_sdk_subtools_unittest.py
+++ b/scripts/build_sdk_subtools_unittest.py
@@ -4,7 +4,6 @@
 
 """Unit tests for build_sdk_subtools."""
 
-import os
 from pathlib import Path
 from unittest import mock
 
@@ -121,11 +120,7 @@
         returncode=42,
     )
 
-    # Avoid bots passing CROS_CACHEDIR via `sudo` and messing up cmd matching.
-    with mock.patch.dict("os.environ"):
-        os.environ.pop("CROS_CACHEDIR", None)
-        assert build_sdk_subtools.main() == 42
-
+    assert build_sdk_subtools.main() == 42
     assert run_mock.call_count == 2
     assert outside_chroot.called