Author: gnichols
Date: 2010-12-15 17:02:51 +0000 (Wed, 15 Dec 2010)
New Revision: 689
Modified:
trunk/v7/testdocument.py
Log:
659789 - Enhance command set for better usability and control of testing
Modified: trunk/v7/testdocument.py
===================================================================
--- trunk/v7/testdocument.py 2010-12-15 17:02:29 UTC (rev 688)
+++ trunk/v7/testdocument.py 2010-12-15 17:02:51 UTC (rev 689)
@@ -18,7 +18,7 @@
import time
from xml.dom.minidom import getDOMImplementation, parse
import xml.dom.ext
-from tags import Tags, Attributes, Constants
+from tags import Tags, Attributes, Constants, TestTag
from documentbase import DocumentWrapper, DocumentBase
from rundocument import RunDocument
import version
@@ -35,6 +35,17 @@
self.document = document
self.mode = None
+ def __cmp__(self, other):
+ if TestTag.interactive in self.getTags() and not TestTag.interactive in
other.getTags():
+ return -1
+ if not TestTag.interactive in self.getTags() and TestTag.interactive in
other.getTags():
+ return 1
+ if self.getPriority() < other.getPriority():
+ return -1
+ if self.getPriority() > other.getPriority():
+ return 1
+ return 0
+
def getKey(self):
return "%s-%s-%s" % (self.getName(), self.getUDI(),
self.getLogicalDeviceName())
@@ -42,6 +53,7 @@
def copyValueOf(self, originalTest):
print "copy Test"
self.setName(originalTest.getName())
+ self.setPriority(originalTest.getPriority())
self.setUDI(originalTest.getUDI())
self.setLabel(originalTest.getLabel())
self.setStatus(originalTest.getStatus())
@@ -57,6 +69,15 @@
def setName(self, name):
if name:
self.element.setAttribute(Attributes.name, name)
+ def getPriority(self):
+ priority = self.element.getAttribute(Attributes.priority)
+ if priority:
+ return int(priority)
+ return 999
+
+ def setPriority(self, priority):
+ if priority:
+ self.element.setAttribute(Attributes.priority, priority)
def getUDI(self):
return self.element.getAttribute(Attributes.udi)
@@ -135,7 +156,7 @@
return self.element.getAttribute(Attributes.source)
def isInteractive(self):
- return (Constants.yes in self.element.getAttribute(Attributes.interactive))
+ return (TestTag.interactive in self.getTags())
def getMandatory(self):
return self.element.getAttribute(Attributes.mandatory)
Show replies by date