本文整理汇总了Python中Testing类的典型用法代码示例。如果您正苦于以下问题:Python Testing类的具体用法?Python Testing怎么用?Python Testing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Testing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _spec_test_output
def _spec_test_output(self, spec):
'''Wrapper that checks spec file and returns output'''
pkg = Testing.getTestedSpecPackage(spec)
Testing.startTest()
# call check_spec() directly, as check() doesn't work with getTestedSpecPackage()
SCLCheck.check.check_spec(pkg, pkg.name)
return Testing.getOutput()
示例2: changeParamValueToggle
def changeParamValueToggle(self, w, path, value_name, old_path=None):
param_widget = self.getParamWidget(w, path, value_name, old_path)
self.assertNotEqual(param_widget, None)
pos = param_widget.valueTestPosition()
widget = param_widget.valueTestWidget()
QTest.mouseMove(widget, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例3: selectMesh
def selectMesh(self, w, mesh_type, dim=2, nx=10, ny=10):
path = "/Mesh"
self.clickOnTree(w, path, expand=True, include=True)
self.changeParamTypeCombo(w, path, mesh_type)
self.changeParamValueText(w, path, "nx", str(nx))
self.changeParamValueText(w, path, "ny", str(ny))
self.changeParamCombo(w, path, "dim", "2")
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例4: saveNodeWidget
def saveNodeWidget(self, w, path, old_path=None):
node_widget = self.getNodeWidget(w, path, old_path)
self.assertNotEqual(node_widget, None)
apply_button = Testing.findQObjectsByName(node_widget, "apply_button")
self.assertEqual(len(apply_button), 1)
self.assertEqual(apply_button[0].isEnabled(), True)
self.clickButton(apply_button)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
self.assertEqual(apply_button[0].isEnabled(), False)
示例5: setOutput
def setOutput(self, w, csv=False, exodus=False):
path = "/Outputs"
self.clickOnTree(w, path, expand=True, include=True)
if exodus:
self.changeParamValueToggle(w, path, "exodus")
if csv:
self.changeParamValueToggle(w, path, "csv")
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例6: addVariable
def addVariable(self, w, var_name, include_vars=False, expand_vars=False, include=True):
self.addToNode(w, "/Variables", expand=expand_vars, include=include_vars)
new_path = "/Variables/New0"
if include:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamValueText(w, new_path, "name", var_name)
name_path = "/Variables/%s" % var_name
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例7: clickTab
def clickTab(self, app, tab_name):
peacock_tab_widgets = Testing.findQObjectsByName(app, "PeacockMainWindow/tab_plugin")
self.assertEqual(len(peacock_tab_widgets), 1)
tabs = peacock_tab_widgets[0]
for i in range(tabs.count()):
if tabs.tabText(i) == tab_name:
tab_bar = tabs.tabBar()
rect = tab_bar.tabRect(i)
QTest.mouseMove(tab_bar, rect.center())
QTest.mouseClick(tab_bar, Qt.LeftButton, pos=rect.center(), delay=100)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
return
示例8: setExecutioner
def setExecutioner(self, w, exe_type, solve_type=None, petsc_iname=None, petsc_value=None, include_exe=False, expand_exe=False):
path = "/Executioner"
self.clickOnTree(w, path, expand=expand_exe, include=include_exe)
self.changeParamTypeCombo(w, path, exe_type)
if petsc_iname:
self.changeParamValueText(w, path, "petsc_options_iname", petsc_iname)
if petsc_value:
self.changeParamValueText(w, path, "petsc_options_value", petsc_value)
if solve_type:
self.changeParamCombo(w, path, "solve_type", solve_type)
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例9: addKernel
def addKernel(self, w, name, kernel_type, variable, include_kernels=False, expand_kernels=False):
self.addToNode(w, "/Kernels", expand=expand_kernels, include=include_kernels)
new_path = "/Kernels/New0"
if include_kernels:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamTypeCombo(w, new_path, kernel_type)
self.changeParamCombo(w, new_path, "variable", variable)
self.changeParamValueText(w, new_path, "name", name)
name_path = "/Kernels/%s" % name
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例10: addBC
def addBC(self, w, name, variable, boundary, bc_type="DirichletBC", value="0", include_bc=False, expand_bc=False, include=True):
self.addToNode(w, "/BCs", expand=expand_bc, include=include_bc)
new_path = "/BCs/New0"
if include:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamTypeCombo(w, new_path, bc_type)
self.changeParamValueText(w, new_path, "name", name)
name_path = "/BCs/%s" % name
self.changeParamValueText(w, name_path, "value", value, new_path)
self.changeParamValueText(w, name_path, "boundary", boundary, new_path)
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例11: test
def test(root):
data = Testing.createData(2000,20)
model = TableModel()
model.importDict(data)
app = App(root)
master = app.main
table = LargeTable(master, model)
#table.load('large.table')
table.createTableFrame()
示例12: addToNode
def addToNode(self, w, path, expand=False, include=False):
if expand:
self.clickOnTree(w, path, expand=True)
if include:
self.clickOnTree(w, path, include=True)
node_widget = self.getNodeWidget(w, path)
add_button = Testing.findQObjectsByName(node_widget, "add_button")
self.assertEqual(add_button[0].isEnabled(), True)
self.clickButton(add_button)
示例13: _print
def _print(msgtype, pkg, reason, details):
global _badness_score
threshold = badnessThreshold()
badness = 0
if threshold >= 0:
badness = Config.badness(reason)
# anything with badness is an error
if badness:
msgtype = 'E'
# errors without badness become warnings
elif msgtype == 'E':
msgtype = 'W'
ln = ""
if pkg.current_linenum is not None:
ln = "%s:" % pkg.current_linenum
arch = ""
if pkg.arch is not None:
arch = ".%s" % pkg.arch
s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, msgtype, reason)
if badness:
s = s + " (Badness: %d)" % badness
for d in details:
s = s + " %s" % d
if Testing and Testing.isTest():
Testing.addOutput(s)
else:
if _rawout:
print(s.encode(locale.getpreferredencoding(), "replace"),
file=_rawout)
if not Config.isFiltered(s):
printed_messages[msgtype] += 1
_badness_score += badness
if threshold >= 0:
_diagnostic.append(s + "\n")
else:
__print(s)
if Config.info:
printDescriptions(reason)
return True
return False
示例14: clickOnTree
def clickOnTree(self, w, path, expand=False, include=False):
tree = self.getTreeWidget(w)
item = tree.findPathItem(path)
self.assertNotEqual(item, None)
tree.scrollToItem(item)
tree.setCurrentItem(item)
rect = tree.visualItemRect(item)
viewport = tree.viewport()
pos = rect.center()
if expand or include:
pos = rect.bottomLeft()
pos.setY(pos.y() - rect.height()/2)
if include:
pos.setX(pos.x() + 10)
QTest.mouseMove(tree, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(viewport, Qt.LeftButton, delay=100, pos=pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例15: testcheck
def testcheck(self):
SpecCheck.check.check_spec(self.pkg, self.pkg.name)
out = "\n".join(Testing.getOutput())
self.assertTrue("patch-not-applied Patch3" in out)
self.assertFalse(re.search("patch-not-applied Patch\\b", out))
self.assertFalse(re.search("patch-not-applied Patch[01245]", out))
self.assertTrue("libdir-macro-in-noarch-package" not in out)
self.assertTrue(len(re.findall("macro-in-comment", out)) == 1)
self.assertTrue("unversioned-explicit-provides unversioned-provides"
in out)
self.assertTrue("unversioned-explicit-provides versioned-provides"
not in out)
self.assertTrue("unversioned-explicit-obsoletes unversioned-obsoletes"
in out)
self.assertTrue("unversioned-explicit-obsoletes versioned-obsoletes"
not in out)