python - Nicer way to represent call differences in mocks, in pytest (or in general?) -
i'm having issue i'm using mock
library in python (2.7), , see errors this:
def raise_from(value, from_value): > raise value e assertionerror: expected call: run_sync(country_code='gb', email_data={'username': 'username-1n@n3m((', 'hotelier_name': 'alexander qw*!@h#(!*@#', 'id': 'hotel-id-8nabqtqw', 'hotelier_email': 'alexander@rnwmenrqnweq#!@#.com', 'name': 'hotel-name-8nabqtqw'}, i18n_labels=<magicmock name='elami_labels' id='140095030265936'>, mail_service=<magicmock name='mock.mail_service.users().messages()' id='140095028784272'>, partner_id='partner-facebooking-@j344', partner_name='partner-name-anqwwenn', product=<product object @ 0x7f6a6ad1da50>, username='username-1n@n3m((') e actual call: run_sync(country_code='gb', email_data={'username': 'username-1n@n3m((', 'hotelier_name': 'alexander qw*!@h#(!*@#', 'id': 'hotel-id-8nabqtqw', 'hotelier_email': 'alexander@rnwmenrqnweq#!@#.com', 'name': 'hotel-name-8nabqtqw'}, i18n_labels=<magicmock name='elami_labels' id='140095030265936'>, mailing_service=<magicmock name='mock.mail_service.users().messages()' id='140095028784272'>, partner_id='partner-facebooking-@j344', partner_name='partner-name-anqwwenn', product=<product object @ 0x7f6a6ad1da50>, username='username-1n@n3m((')
this looks ok here, because of scrolling, looks lot worse in console. this:
e assertionerror: expected call: run_sync(country_code='gb', email_data={'username': 'username-1n@n3m((', 'hotelier_name': 'alexander qw*!@h#(!*@#', 'id': 'hotel-id-8nabqtqw', 'hotelier_email': 'alexander@rnwmenrqnweq#!@#.com', 'name': 'hotel-name-8nabqtqw'}, i18n_labels=, mail_service=, partner_id='partner-facebooking-@j344', partner_name='partner-name-anqwwenn', product=, username='username-1n@n3m((')
e actual call: run_sync(country_code='gb', email_data={'username': 'username-1n@n3m((', 'hotelier_name': 'alexander qw*!@h#(!*@#', 'id': 'hotel-id-8nabqtqw', 'hotelier_email': 'alexander@rnwmenrqnweq#!@#.com', 'name': 'hotel-name-8nabqtqw'}, i18n_labels=, mailing_service=, partner_id='partner-facebooking-@j344', partner_name='partner-name-anqwwenn', product=, username='username-1n@n3m((')
even so, because 2 lines not aligned, it's hard spot differences.
is there tool can fix this? i'm not @ pytest extensions, if there none, should write 1 - if that's possible. i'm sure lot of people have problem time.
or perhaps there's way, independent of py.test show such difference... quick way parse calls , have show our error.
give pytest-sugar try:
a plugin py.test changes default , feel of py.test (e.g. progressbar, show tests fail instantly)
seems step forward in having prettier output pytest
.
Comments
Post a Comment