From d78bc8fb198adc81196537e448158e984335cce8 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Sat, 27 Jul 2013 00:21:45 -0400 Subject: [PATCH] Fix so command tests will work on Django 1.4.x. --- awx/main/tests/commands.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/main/tests/commands.py b/awx/main/tests/commands.py index 78cf7bc915..eae6c351fc 100644 --- a/awx/main/tests/commands.py +++ b/awx/main/tests/commands.py @@ -146,6 +146,10 @@ class BaseCommandTest(BaseTest): sys.stdin = original_stdin sys.stdout = original_stdout sys.stderr = original_stderr + # For Django 1.4.x, convert sys.exit(1) and stderr message to the + # CommandError(msg) exception used by Django 1.5 and later. + if isinstance(result, SystemExit) and captured_stderr: + result = CommandError(captured_stderr) return result, captured_stdout, captured_stderr class CleanupDeletedTest(BaseCommandTest):