cros_portage_upgrade_unittest: Remove OutputTestCase usage
Replace all usages of OutputTestCase and OutputCapturer in
cros_portage_upgrade_unittest. This means that no tests are deselected
from this module and the only tests that are skipped are those that had
already been marked with unittest.skip().
BUG=chromium:1062691
TEST=`run_pytest`
Change-Id: Ibfc4383679d561ae9d10d07075f8576acf8343aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2141173
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
diff --git a/conftest.py b/conftest.py
index c1870e4..db5f78d 100644
--- a/conftest.py
+++ b/conftest.py
@@ -47,3 +47,21 @@
if children:
pytest.fail('Test has %s active child processes after tearDown: %s' %
(len(children), children))
+
+
+@pytest.fixture
+def legacy_capture_output(request, capfd):
+ """Adds the `capfd` fixture to TestCase-style test classes.
+
+ This fixture should only be used on cros_test_lib.TestCase test classes, since
+ it doesn't yield anything and just attaches the built-in pytest `capfd`
+ fixture to the requesting class. Tests written as standalone functions should
+ use pytest's built-in `capfd` fixture instead of this. See the documentation
+ for more information on how to use the `capfd` fixture that this provides:
+ https://docs.pytest.org/en/latest/reference.html#capfd
+
+ See the following documentation for an explanation of why fixtures have to be
+ provided to TestCase classes in this manner:
+ https://docs.pytest.org/en/latest/unittest.html#mixing-pytest-fixtures-into-unittest-testcase-subclasses-using-marks
+ """
+ request.cls.capfd = capfd