From 35d06e668aea107b6a8445cddcc50d2d18139e95 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 3 Feb 2014 15:53:54 -0500 Subject: [PATCH] setup: Add tests --regenerate-output Static variable is too dangerous (notice I forgot to unset it with a recent commit) --- setup.py | 3 +++ tests/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b774f898..50955d71 100755 --- a/setup.py +++ b/setup.py @@ -373,12 +373,14 @@ class TestBaseCommand(Command): user_options = [ ('debug', 'd', 'Show debug output'), ('coverage', 'c', 'Show coverage report'), + ('regenerate-output', None, 'Regenerate test output'), ("only=", None, "Run only testcases whose name contains the passed string"), ] def initialize_options(self): self.debug = 0 + self.regenerate_output = 0 self.coverage = 0 self.only = None self._testfiles = [] @@ -404,6 +406,7 @@ class TestBaseCommand(Command): import tests as testsmodule testsmodule.cov = cov + testsmodule.utils.REGENERATE_OUTPUT = bool(self.regenerate_output) if hasattr(unittest, "installHandler"): try: diff --git a/tests/utils.py b/tests/utils.py index 989c6922..07beb5d4 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -28,8 +28,8 @@ from virtinst import VirtualDisk from virtinst import VirtualGraphics from virtinst import VirtualVideoDevice -# Enable this to refresh test output -REGENERATE_OUTPUT = True +# DON'T EDIT THIS. Use 'setup.py test --regenerate-output' +REGENERATE_OUTPUT = False # pylint: disable=W0212 # Access to protected member, needed to unittest stuff