6996397 InstallEngine missing import of warnings module
authorKaren Tung <karen.tung@oracle.com>
Tue, 02 Nov 2010 08:59:11 -0700
changeset 913 83925e67521c
parent 912 16acad94ca14
child 914 5eadb507f472
6996397 InstallEngine missing import of warnings module
usr/src/lib/install_engine/__init__.py
usr/src/lib/install_engine/test/test_engine.py
--- a/usr/src/lib/install_engine/__init__.py	Mon Nov 01 10:53:05 2010 -0700
+++ b/usr/src/lib/install_engine/__init__.py	Tue Nov 02 08:59:11 2010 -0700
@@ -36,6 +36,7 @@
 import string
 import tempfile
 import threading
+import warnings
 
 import osol_install.errsvc as errsvc
 import osol_install.liberrsvc as liberrsvc
--- a/usr/src/lib/install_engine/test/test_engine.py	Mon Nov 01 10:53:05 2010 -0700
+++ b/usr/src/lib/install_engine/test/test_engine.py	Tue Nov 02 08:59:11 2010 -0700
@@ -33,6 +33,7 @@
 import shutil
 import threading
 import unittest
+import warnings
 
 from itertools import izip
 from logging import ERROR, DEBUG
@@ -850,6 +851,15 @@
         self.assertNotEqual(cp, None)
         self.assertEqual(cp.name, expected_failed_cp[0])
 
+    def test_nothing_to_exec(self): 
+        '''Validate a warning is issued when there's no checkpoint to execute'''
+        with warnings.catch_warnings(record=True) as w:
+            self.engine.execute_checkpoints(start_from="one",
+                                            pause_before="one")
+
+            self.assertEqual(len(w), 1)
+            self.assertTrue(w[-1].category, UserWarning)
+
     def test_gen_tmp_dir_w_env(self):
         '''Validate path of tmp DOC dir is determined correctly with TEMP_DOC_DIR env variable '''