#6212 Pretty-print mismatches in tests
Closed: Fixed None Opened 7 years ago by pspacek.

Currently error reporting in tests makes it very hard to understand what is going on. A small change in output would make it better.

Compare current error message:

AssertionError: assert_deepequal: list length mismatch.   0014: dnsforwardzone_add: Create forward zone u'fwzone2.test.' with forwarders with default ("first") policy   len(expected) = 2   len(got) = 1   expected = [{u'data': {}, u'message': <function <lambda> at 0x7f0d71858758>, u'code': 13021, u'type': u'warning', u'name': u'DNSForwardPolicyConflictWithEmptyZone'}, {u'data': {u'server': u'fwzone2.test.', u'error': <function <lambda> at 0x7f0d71858848>}, u'message': <function <lambda> at 0x7f0d718587d0>, u'code': 13006, u'type': u'warning', u'name': u'DNSServerValidationWarning'}]   got = [{u'data': {u'error': u"query 'fwzone2.test. SOA': The DNS operation timed out after 10.0005779266 seconds", u'server': u'172.16.15.1'}, u'message': u"DNS server 172.16.15.1: query 'fwzone2.test. SOA': The DNS operation timed out after 10.0005779266 seconds.", u'code': 13006, u'type': u'warning', u'name': u'DNSServerValidationWarning'}]   path = (u'messages',)

... with an error message with pretty-printed expected and got variables:

AssertionError: assert_deepequal: list length mismatch.   0014: dnsforwardzone_add: Create forward zone u'fwzone2.test.' with forwarders with default ("first") policy   len(expected) = 2   len(got) = 1   expected = 
[{u'code': 13021,
  u'data': {},
  u'message': '<function <lambda> at 0x7f0d71858758>',
  u'name': u'DNSForwardPolicyConflictWithEmptyZone',
  u'type': u'warning'},
 {u'code': 13006,
  u'data': {u'error': '<function <lambda> at 0x7f0d71858848>',
            u'server': u'fwzone2.test.'},
  u'message': '<function <lambda> at 0x7f0d718587d0>',
  u'name': u'DNSServerValidationWarning',
  u'type': u'warning'}]
got = [{u'code': 13006,
  u'data': {u'error': u"query 'fwzone2.test. SOA': The DNS operation timed out after 10.0005779266 seconds",
            u'server': u'172.16.15.1'},
  u'message': u"DNS server 172.16.15.1: query 'fwzone2.test. SOA': The DNS operation timed out after 10.0005779266 seconds.",
  u'name': u'DNSServerValidationWarning',
  u'type': u'warning'}]

master:

  • ecd6cb4 Pretty-print structures in assert_deepequal

ipa-4-4:

  • d982710 Pretty-print structures in assert_deepequal

Metadata Update from @pspacek:
- Issue assigned to stlaz
- Issue set to the milestone: FreeIPA 4.4.2

7 years ago

Login to comment on this ticket.

Metadata