def compare_session(self, expected): """Compare the current sessions against the given template. partial_compare is used, which means only the keys/values listed will be compared. """ __tracebackhide__ = lambda e: e.errisinstance(pytest.fail.Exception) data = self.get_session() expected = yaml.load(expected, Loader=YamlLoader) outcome = testutils.partial_compare(data, expected) if not outcome: msg = "Session comparison failed: {}".format(outcome.error) msg += '\nsee stdout for details' pytest.fail(msg)
def test_partial_compare_not_equal(val1, val2, error): outcome = testutils.partial_compare(val1, val2) assert not outcome assert isinstance(outcome, testutils.PartialCompareOutcome) assert outcome.error == error
def test_partial_compare_equal(val1, val2): assert testutils.partial_compare(val1, val2)