|
|
0f880b |
From c10698daec30cb65243ccc2a5b7c9979c83b6f9e Mon Sep 17 00:00:00 2001
|
|
|
0f880b |
From: Chris Lumens <clumens@redhat.com>
|
|
|
0f880b |
Date: Fri, 4 Mar 2016 14:30:16 -0500
|
|
|
0f880b |
Subject: [PATCH] Make sure the script test references parser.
|
|
|
0f880b |
|
|
|
0f880b |
What I was seeing was that the test failed because the script strings
|
|
|
0f880b |
didn't have a %end on them. That means the version was being set to
|
|
|
0f880b |
something pre-F8. It only happened if any of the pre* or post* tests
|
|
|
0f880b |
were run first - if those were moved out of the way, the script test
|
|
|
0f880b |
would pass. These tests were therefore the ones causing the version to
|
|
|
0f880b |
be set incorrectly.
|
|
|
0f880b |
|
|
|
0f880b |
What's happening is those tests set the version to something old, but
|
|
|
0f880b |
nothing sets the version back. That's because Script references a
|
|
|
0f880b |
global ver variable which is set when a parser is created. The Script
|
|
|
0f880b |
test doesn't create a parser so ver was staying set to whatever old
|
|
|
0f880b |
value pre* and post* were setting.
|
|
|
0f880b |
|
|
|
0f880b |
(cherry picked from commit 5c33825407035f33bfd8ae257ec093c10937b81c)
|
|
|
0f880b |
---
|
|
|
0f880b |
tests/script.py | 11 +++++++++--
|
|
|
0f880b |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
0f880b |
|
|
|
0f880b |
diff --git a/tests/script.py b/tests/script.py
|
|
|
0f880b |
index bad9b81..7ef1002 100644
|
|
|
0f880b |
--- a/tests/script.py
|
|
|
0f880b |
+++ b/tests/script.py
|
|
|
0f880b |
@@ -1,12 +1,19 @@
|
|
|
0f880b |
import unittest
|
|
|
0f880b |
|
|
|
0f880b |
-from tests.baseclass import CommandTest
|
|
|
0f880b |
+from tests.baseclass import ParserTest
|
|
|
0f880b |
|
|
|
0f880b |
from pykickstart.constants import KS_SCRIPT_POST, KS_SCRIPT_PRE, KS_SCRIPT_PREINSTALL, KS_SCRIPT_TRACEBACK, KS_SCRIPT_ONERROR
|
|
|
0f880b |
from pykickstart.parser import Script
|
|
|
0f880b |
+from pykickstart.version import DEVEL
|
|
|
0f880b |
|
|
|
0f880b |
-class Script_Object_TestCase(CommandTest):
|
|
|
0f880b |
+class Script_Object_TestCase(ParserTest):
|
|
|
0f880b |
def runTest(self):
|
|
|
0f880b |
+ # The parser object will never be set up by this test, which means the
|
|
|
0f880b |
+ # Script object will get the version number of whatever ran last. That
|
|
|
0f880b |
+ # could be totally wrong. Thus, cause the parser to be created here
|
|
|
0f880b |
+ # so the version will be right.
|
|
|
0f880b |
+ self.get_parser()
|
|
|
0f880b |
+
|
|
|
0f880b |
body = "import sys\nsys.exit(1)\n"
|
|
|
0f880b |
obj = Script(body, type=KS_SCRIPT_PRE, interp="/usr/bin/python", logfile="/tmp/log", errorOnFail=True)
|
|
|
0f880b |
self.assertEqual(obj.type, KS_SCRIPT_PRE)
|
|
|
0f880b |
--
|
|
|
0f880b |
2.17.1
|
|
|
0f880b |
|