Blame SOURCES/0001-Make-sure-the-script-test-references-parser.patch

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