A miscellany of code used to run Trial tests.
Maintainer: Jonathan Lange
| Class | |
A test suite which remove the tests once run, to minimize memory usage. |
| Class | |
Used to insert arbitrary errors into a test suite run. Provides enough methods to look like a TestCase, however, when it is run, it simply adds an error to the TestResult. The most common use-case is for when a module fails to import. |
| Class | |
Any errors logged in this suite will be reported to the TestResult object. |
| Class | |
Placeholder for a TestCase inside a reporter. As far as a TestResult is concerned, this looks exactly like a unit test. |
| Class | |
I find tests inside function, modules, files -- whatever -- then return them wrapped inside a Test (either a TestSuite or a TestCase). |
| Class | |
A specialised runner that the trial front end uses. |
| Class | |
Suite to wrap around every single test in a trial run. Used internally by Trial to set up things necessary for Trial tests to work, regardless of what context they are run in. |
| Function | filename |
Given a filename, do whatever possible to return a module object matching that file. |
| Function | is |
Given an object return True if the object looks like a package |
| Function | is |
Is the directory at path 'dirname' a Python package directory? Returns the name of the __init__ file (it may have a weird extension) if dirname is a package directory. Otherwise, returns False |
| Function | is |
No summary |
| Function | name |
No summary |
| Function | samefile |
A hacky implementation of os.path.samefile. Do not use this. |
| Constant | NOT |
Undocumented |
| Class | _ |
Undocumented |
| Class | _ |
Undocumented |
| Function | _get |
Find the attribute name on the method's class which refers to the method. |
| Function | _import |
Undocumented |
| Function | _log |
A context manager which adds a log observer and then removes it. |
| Function | _qual |
Given a Python qualified name, this function yields a 2-tuple of the most specific qualified name first, followed by the next-most-specific qualified name, and so on, paired with the remainder of the qualified name. |
| Function | _resolve |
Undocumented |
| Function | _test |
A context manager which obtains a lock on a trial working directory and enters (os.chdir) it and then reverses these things. |
| Constant | _P |
Undocumented |
| Type Alias | _ |
Undocumented |
Given a filename, do whatever possible to return a module object matching that file.
If the file in question is a module in Python path, properly import and return that module. Otherwise, load the source manually.
| Parameters | |
| fn | A filename. |
| Returns | |
| A module object. |
| Raises | |
ValueError | If fn does not exist. |
Is the directory at path 'dirname' a Python package directory? Returns the name of the __init__ file (it may have a weird extension) if dirname is a package directory. Otherwise, returns False
| Returns | |
TypeGuard[ | True if obj is a class that contains test cases, False otherwise. Used to find all the tests in a module. |
str, filename2: str) -> bool:
(source)
¶
A hacky implementation of os.path.samefile. Do not use this.
Find the attribute name on the method's class which refers to the method.
For some methods, notably decorators which have not had __name__ set correctly:
getattr(method.im_class, method.__name__) != method
Given a Python qualified name, this function yields a 2-tuple of the most specific qualified name first, followed by the next-most-specific qualified name, and so on, paired with the remainder of the qualified name.
| Parameters | |
qualstr | A Python qualified name. |
Undocumented
| Value |
|