Home | Trees | Indices | Help |
|
---|
|
Helper functions and classes for unit tests and similar.
Whatever is useful to unit tests from here should be imported into testhelpers, too. Unit test modules should not be forced to import this.
Classes | |
XSDResolver A resolver for external entities only returning in-tree files. |
|
QNamer A hack that generates QNames through getattr. |
|
XSDTestMixin provides a assertValidates method doing XSD validation. |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
RESOLVER = <gavo.helpers.testtricks.XSDResolver object>
|
|
XSD_PARSER = <lxml.etree.XMLParser object>
|
|
XS = <gavo.helpers.testtricks.QNamer object>
|
|
VO_SCHEMATA =
|
|
NEWIDS =
|
|
__package__ =
|
Function Details |
returns an ``libxml2`` etree for ``xmlString``, where, for convenience, all namespaces on elements are nuked. The libxml2 etree lets you do xpath searching using the ``xpath`` method. Nuking namespaces is of course not a good idea in general, so you might want to think again before you use this in production code. |
returns Xerces error messages for XSD validation of data, or None if data is valid. See the docstring of XSDTestMixin for how to make this work. This raises a unittest.SkipTest exception if the validator cannot be found. |
|
returns an lxml validator containing the schemas in schemaPaths. schemaPaths must be actual file paths, absolute or trunk/schema-relative. |
returns a validator that knows the schemata typically useful within the VO. This will currently only work if DaCHS is installed from an SVN checkout with setup.py develop. What's returned has a method assertValid(et) that raises an exception if the elementtree et is not valid. You can simply call it to get back True for valid and False for invalid. |
returns error messages for the XSD validation of the string in data. This is the lxml-based implemenation, much less disruptive than the xerces-based one. |
returns error messages for the XSD validation of the string in data. This is the lxml-based implemenation, much less disruptive than the xerces-based one. |
returns a function to call that returns a list of new DaCHS structures since this was called. If you watch everything, things get hairy because of course the state of this function (for instance) also creates references. Hence, pass ofClass to choose what the funtion will track. This will call a gc.collect itself (and wouldn't make sense without that) |
a debug method to track memory usage after some code has run. This is typically run from ArchiveService.locateChild, since request processing should be idempotent wrt memory after initial caching. This is for editing in place by DaCHS plumbers; accordingly, you're not supposed to make sense of this. |
a context manager that creates a file name with content in inDir. The full path name is returned. With writeGz=True, content is gzipped on the fly (don't do this if the data already is gzipped). You can pass in name=None to get a temporary file name if you don't care about the name. inDir will be created as a side effect if it doesn't exist but (right now, at least), not be removed.
|
a context manager collecting event arguments for a while. The yielded thing is a list that contains tuples of event name and the event arguments.
|
Variables Details |
VO_SCHEMATA
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu May 2 07:29:09 2019 | http://epydoc.sourceforge.net |