schrodinger.test.perceptualdiff module¶
Run Perceptual Diff tests in maestrolibs
-
class
schrodinger.test.perceptualdiff.
Notify
(value)[source]¶ Bases:
enum.Enum
An enumeration.
-
No
= 'no'¶
-
Email
= 'email'¶
-
Terminal
= 'terminal'¶
-
-
schrodinger.test.perceptualdiff.
get_notification_method
()[source]¶ Get the failure notification method based on username and the SCHRODINGER_IMAGE_DIFF_NOTIFICATION environment variable.
-
class
schrodinger.test.perceptualdiff.
PerceptualDiffTest
(*k, **kw)[source]¶ Bases:
schrodinger.test.pytest.exetest.ExecutableTest
The tests that use perceptualdiff all require some boilerplate arguments:
-r: path to the result image -v: path to the valid images (without _<number>.png) -d: path to the difference image
-
__init__
(*, name=None, parent=None, valid_path=None, valid_filename=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
getCommand
()[source]¶ Build the list command arguments to execute the test.
- Parameters
memtest_cmd (list or None) – command string section to make the test run through valgrind.
- Returns
list
-
runtest
(env=None)[source]¶ Executed for each test. (pytest method)
Relegate this to a function that is easier to test.
- Parameters
env (dict) – Shell environment for subprocess.Popen
capture – Should output be captured and stored? If not, it goes to stdout.
stdout (file-like object) – file descriptor, file object, or subprocess special variable for use as stdout argument to subprocess call. Overrides capture if not None.
stderr – file descriptor, file object, or subprocess special variable for use as stderr argument to subprocess call. Overrides capture if not None.
-
name
¶
-
parent
¶
-
config
¶
-
session
¶
-
fspath
¶
-
add_marker
(marker: Union[str, _pytest.mark.structures.MarkDecorator], append: bool = True) → None¶ Dynamically add a marker object to the node.
- Parameters
append – Whether to append the marker, or prepend it.
-
add_report_section
(when: str, key: str, content: str) → None¶ Add a new report section, similar to what’s done internally to add stdout and stderr captured output:
item.add_report_section("call", "stdout", "report section contents")
- Parameters
when (str) – One of the possible capture states,
"setup"
,"call"
,"teardown"
.key (str) – Name of the section, can be customized at will. Pytest uses
"stdout"
and"stderr"
internally.content (str) – The full contents as a string.
-
addfinalizer
(fin: Callable[], object]) → None¶ Register a function to be called when this node is finalized.
This method can only be called when this node is active in a setup chain, for example during self.setup().
-
findValgrindSuppressionsFiles
(src_dirname)¶ Search from the test directory in the source repository to $SCHRODINGER_SRC. Also search $SCHRODINGER_SRC/build_tools.
-
classmethod
from_parent
(parent: _pytest.nodes.Node, **kw)¶ Public constructor for Nodes.
This indirection got introduced in order to enable removing the fragile logic from the node constructors.
Subclasses can use
super().from_parent(...)
when overriding the construction.- Parameters
parent – The parent node of this Node.
-
get_closest_marker
(name: str, default: Optional[_pytest.mark.structures.Mark] = None) → Optional[_pytest.mark.structures.Mark]¶ Return the first marker matching the name, from closest (for example function) to farther level (for example module level).
- Parameters
default – Fallback return value if no marker was found.
name – Name to filter by.
-
getparent
(cls: Type[_NodeType]) → Optional[_NodeType]¶ Get the next parent node (including self) which is an instance of the given class.
-
property
ihook
¶ fspath-sensitive hook proxy used to call pytest hooks.
-
iter_markers
(name: Optional[str] = None) → Iterator[_pytest.mark.structures.Mark]¶ Iterate over all markers of the node.
- Parameters
name – If given, filter the results by the name attribute.
-
iter_markers_with_node
(name: Optional[str] = None) → Iterator[Tuple[_pytest.nodes.Node, _pytest.mark.structures.Mark]]¶ Iterate over all markers of the node.
- Parameters
name – If given, filter the results by the name attribute.
- Returns
An iterator of (node, mark) tuples.
-
listchain
() → List[_pytest.nodes.Node]¶ Return list of all parent collectors up to self, starting from the root of collection tree.
-
listextrakeywords
() → Set[str]¶ Return a set of all extra keywords in self and any parents.
-
listnames
() → List[str]¶
-
property
location
¶
-
nextitem
= None¶
-
property
nodeid
¶ A ::-separated string denoting its collection tree address.
-
reportinfo
()¶ The short and long names of the test. (pytest method)
-
repr_failure
(excinfo)¶ Called when self.runtest() raises an exception. (pytest method)
-
setup
() → None¶
-
teardown
() → None¶
-
warn
(warning: Warning) → None¶ Issue a warning for this Node.
Warnings will be displayed after the test session, unless explicitly suppressed.
- Parameters
warning (Warning) – The warning instance to issue.
- Raises
ValueError – If
warning
instance is not a subclass of Warning.
Example usage:
node.warn(PytestWarning("some message")) node.warn(UserWarning("some message"))
Changed in version 6.2: Any subclass of
Warning
is now accepted, rather than onlyPytestWarning
subclasses.
-