From b8568edc3b467c880044ff760b55a5a720b38089 Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Wed, 5 Aug 2015 11:00:43 -0400 Subject: [PATCH] Restore sys.stdout for db delete prompt --- django_nose/plugin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django_nose/plugin.py b/django_nose/plugin.py index a7aa5c1..4505ef2 100644 --- a/django_nose/plugin.py +++ b/django_nose/plugin.py @@ -363,7 +363,13 @@ def __init__(self, tests, runner): def setup(self): """Setup database.""" - self.old_names = self.runner.setup_databases() + # temporarily restore sys.stdout in case of propmt to delete database + test_stdout = sys.stdout + sys.stdout = sys.__stdout__ + try: + self.old_names = self.runner.setup_databases() + finally: + sys.stdout = test_stdout def teardown(self): """Tear down database."""