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