Home | Trees | Indices | Help |
|
---|
|
Provides unit-testing utilities.
These utilities are kept here, separate from util.py, because they provide common functionality that I do not want exported "publicly" once Cedar Backup is installed on a system. They are only used for unit testing, and are only useful within the source tree.
Many of these functions are in here because they are "good enough" for unit test work but are not robust enough to be real public functions. Others (like removedir) do what they are supposed to, but I don't want responsibility for making them available to others.Author: Kenneth J. Pronovici <pronovic@ieee.org>
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|
|
"/a/b/c" from ["/a",
"b", "c",] .
|
|
|
os.utime function.
Note: Some platforms don't seem to be able to set an age precisely. As a result, whereas we might have intended to set an age of 86400 seconds, we actually get an age of 86399.375 seconds. When util.calculateFileAge() looks at that the file, it calculates an age of 0.999992766204 days, which then gets truncated down to zero whole days. The tests get very confused. To work around this, I always subtract off one additional second as a fudge factor. That way, the file age will be at least as old as requested later on. |
|
|
Equivalent of It's nice to be able to use This function (which can be easily called by unit test classes) provides an easy way to wrap the assignment checks. It's not pretty, or as intuitive as the original check it's modeled on, but it does work. Let's assume you make this method call:testCase.failUnlessAssignRaises(ValueError, collectDir, "absolutePath", absolutePath)If you do this, a test case failure will be raised unless the assignment: collectDir.absolutePath = absolutePathfails with a ValueError exception. The failure message
differentiates between the case where no exception was raised and the
case where the wrong exception was raised.
Note:
Internally, the See Also:
|
|
|
|
|
|
Sets up a screen logger for debugging purposes. Normally, the CLI functionality configures the logger so that things get written to the right place. However, for debugging it's sometimes nice to just get everything -- debug information and output -- dumped to the screen. This function takes care of that. |
|
Captures the output (stdout, stderr) of a function or a method. Some of our functions don't do anything other than just print output. We need a way to test these functions (at least nominally) but we don't want any of the output spoiling the test suite output. This function just creates a dummy file descriptor that can be used as a target by the callable function, rather thanstdout or
stderr .
Note:
This method assumes that |
|
|
Indicates whether hex float literals are allowed by the interpreter. As far back as 2004, some Python documentation indicated that octal and hex notation applies only to integer literals. However, prior to Python 2.5, it was legal to construct a float with an argument like 0xAC. This check provides a version-based indication of whether the current interpreter supports that behavior. This check exists so that unit tests can continue to test the same thing as always for pre-2.5 interpreters (i.e. making sure backwards compatibility doesn't break) while still continuing to work for later interpreters. The returned value is True for Python <= 2.5, and False otherwise. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sat Nov 15 12:16:54 2008 | http://epydoc.sourceforge.net |