pyworkflow.tests.tests module

class pyworkflow.tests.tests.BaseTest(methodName='runTest')[source]


assertIsNotEmpty(setObject, msg=None)[source]

Check if the pyworkflow object is not None nor is empty

assertSetSize(setObject, size=None, msg=None, diffDelta=None)[source]

Check if a pyworkflow Set is not None nor is empty, or of a determined size or of a determined size with a percentage (base 1) of difference

classmethod compareSets(test, set1, set2)[source]

Iterate the elements of boths sets and check that all elements have equal attributes.

classmethod getOutputPath(*filenames)[source]

Return the path to the SCIPION_HOME/tests/output dir joined with filename

classmethod getRelPath(basedir, filename)[source]

Return the path relative to SCIPION_HOME/tests

classmethod launchProtocol(prot, **kwargs)[source]

Launch a given protocol using cls.proj. Accepted **kwargs:

wait: if True the function will return after the protocol runs.
If not specified, then if waitForOutput is passed, wait is false.

waitForOutputs: a list of expected outputs, ignored if wait=True

classmethod newProtocol(protocolClass, **kwargs)[source]

Create new protocols instances through the project and return a newly created protocol of the given class

static printLastLogLines(prot)[source]
classmethod saveProtocol(prot)[source]

Save protocol using cls.proj

class pyworkflow.tests.tests.DataSet(name, folder, files, url=None)[source]

Bases: object

classmethod getDataSet(name)[source]

This method is called every time the dataset want to be retrieved

class pyworkflow.tests.tests.GTestResult[source]

Bases: unittest.result.TestResult

Subclass TestResult to output tests results with colors (green for success and red for failure) and write a report on an .xml file.

addError(test, err)[source]

Called when an error has occurred. ‘err’ is a tuple of values as returned by sys.exc_info().

addFailure(test, err)[source]

Called when an error has occurred. ‘err’ is a tuple of values as returned by sys.exc_info().


Called when a test has completed successfully

static getTestName(test)[source]
numberTests = 0
openXmlReport(classname, filename)[source]
reportError(test, err)[source]

Called when the given test is about to be run

testFailed = 0
xml = None
pyworkflow.tests.tests.hasLabel(TestClass, labels)[source]

Create the output folder for a give Test class.

pyworkflow.tests.tests.setupTestProject(cls, writeLocalConfig=False)[source]

Create and setup a Project for a give Test class.