[pycopia] r526 committed - Some small improvements. You can now get any equipment runtime directl...

0 views
Skip to first unread message

pyc...@googlecode.com

unread,
Jan 20, 2012, 12:32:35 AM1/20/12
to pyc...@googlegroups.com
Revision: 526
Author: keith.dart
Date: Thu Jan 19 21:31:25 2012
Log: Some small improvements. You can now get any equipment runtime
directly from the database without having to have it in your environment.
Can be useful for shared infrastructure such as power controllers.

http://code.google.com/p/pycopia/source/detail?r=526

Modified:
/trunk/QA/pycopia/QA/config.py
/trunk/process/pycopia/expect.py
/trunk/storage/pycopia/db/importers/testcases.py

=======================================
--- /trunk/QA/pycopia/QA/config.py Tue Nov 22 16:33:58 2011
+++ /trunk/QA/pycopia/QA/config.py Thu Jan 19 21:31:25 2012
@@ -332,6 +332,15 @@
raise config.ConfigError("Bad account identifier %r: %s" %
(name, err))
return acct.login, acct.password

+ def get_equipment(self, name):
+ """Get any equipment runtime from the configuration by name."""
+ db = self.session
+ try:
+ eqrow =
db.query(models.Equipment).filter(models.Equipment.name.contains(name)).one()
+ except config.NoResultFound as err:
+ raise config.ConfigError("Bad equipment name %r: %s" % (name,
err))
+ return EquipmentRuntime(eqrow, "unspecified", self.get_logfile(),
db)
+
# user-specific configuration variables.
# user configuration is explicit, contained in this "userconfig"
attribute,
# which maps to a configuration container that has the same name as the
=======================================
--- /trunk/process/pycopia/expect.py Wed Oct 20 16:37:43 2010
+++ /trunk/process/pycopia/expect.py Thu Jan 19 21:31:25 2012
@@ -401,11 +401,11 @@
while 1:
c = self.read(1, timeout)
if c == "":
- return
+ raise ExpectError("EOF during
read_until({!r}).".format(patt))
buf += c
i = buf.find(patt)
if i >= 0:
- return buf[:-len(patt)]
+ return buf[:i]

def readline(self, timeout=None):
return self.read_until("\n", timeout)
=======================================
--- /trunk/storage/pycopia/db/importers/testcases.py Wed Oct 12 17:26:18
2011
+++ /trunk/storage/pycopia/db/importers/testcases.py Thu Jan 19 21:31:25
2012
@@ -361,6 +361,7 @@
else:
if _FORCE:
_dbsession.delete(dbcase)
+ _dbsession.commit()
dbcase = create_TestCase(testinstance)
else:
update_TestCase(testinstance, dbcase)
@@ -380,6 +381,7 @@
else:
if _FORCE:
_dbsession.delete(dbcase)
+ _dbsession.commit()
dbcase = create_TestCase(entry.inst)
else:
update_TestCase(entry.inst, dbcase)
@@ -412,6 +414,7 @@
else:
if _FORCE:
_dbsession.delete(testsuite)
+ _dbsession.commit()
testsuite = models.create(models.TestSuite, **kwargs)
_dbsession.add(testsuite)
_dbsession.commit()

Reply all
Reply to author
Forward
0 new messages