-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently I write my tests in unittest, but use pytest as a test runner because the coloured output makes it easier to see what's going on at a glance (plus it just looks better). This could be added to marbles as well, since nicer output is a major feature. Examples I'm thinking of:
- Green
./ redFas tests run:
..........................................F......
- Green
ok/ redFAILin verbose mode:
test_not_found (tests.test_users.TestUpdatePassword) ... ok
test_wrong_password (tests.test_users.TestUpdatePassword) ... ok
test_empty_lists (tests.test_utils.TestDropNones) ... ok
test_empty_strings (tests.test_utils.TestDropNones) ... ok
test_no_nones (tests.test_utils.TestDropNones) ... ok
test_nones (tests.test_utils.TestDropNones) ... ok
test_0_to_plus31 (tests.test_utils.TestFormatPhoneNumber) ... FAIL
test_already_formatted (tests.test_utils.TestFormatPhoneNumber) ... ok
test_bad_input (tests.test_utils.TestFormatPhoneNumber) ... ok
test_dashes (tests.test_utils.TestFormatPhoneNumber) ... ok
test_foreign (tests.test_utils.TestFormatPhoneNumber) ... ok
test_plus (tests.test_utils.TestFormatPhoneNumber) ... ok
test_spaces (tests.test_utils.TestFormatPhoneNumber) ... ok
- Highlight important bits of failure messages
- Red
FAILin title to make quick scrolling easier (more visible breaks between mesages) - Maybe some color for the actual assertion message (
'+31612345678' != 'this will fail') - Syntax highlighting in the source lines or traceback (I might be getting carried away here)
- Red
======================================================================
FAIL: test_0_to_plus31 (tests.test_utils.TestFormatPhoneNumber)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/johnpaton/some/path/tests/test_utils.py", line 64, in test_0_to_plus31
self.assertEqual(output, 'this will fail')
File "/Users/johnpaton/some/path/venv/subsidy/lib/python3.6/site-packages/marbles/core/marbles.py", line 532, in wrapper
return attr(*args, msg=annotation, **kwargs)
marbles.core.marbles.ContextualAssertionError: '+31612345678' != 'this will fail'
- +31612345678
+ this will fail
Source (/Users/johnpaton/some/path/tests/test_utils.py):
63 output = utils.format_phone_number(input)
> 64 self.assertEqual(output, 'this will fail')
65
Locals:
output=+31612345678
expected=+31612345678
input=0612345678
----------------------------------------------------------------------
This might be a good use case for colorama and/or pygments at the expense of another dependency.
RUrlus and thejohnfreeman
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request