nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

Ouput test names in the same format that Nose accepts as input #1033

Closed HaraldNordgren closed 6 years ago

HaraldNordgren commented 7 years ago

I restructured the way test data is output in verbose mode for easier everyday use of nose.

Test names are now printed in the same format that Nose takes as input. For example:

$ nosetests -v Test_1.mock_tests:MockTests 
test_print (Test_1.mock_tests.MockTests) ... ok
test_print_again (Test_1.mock_tests.MockTests) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK

Compare this with how Nose currently presents the data,

$ nosetests -v Test_1.mock_tests:MockTests
test_print (Test_1.mock_tests:MockTests.test_print) ... ok
test_print_again (Test_1.mock_tests:MockTests.test_print_again) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK

The difference is in the colon and printing the test function twice. Test_1.mock_tests:MockTests.test_print vs Test_1.mock_tests.MockTests

It might not look like much, but it makes a huge difference when copy-pasting into nosetest to re-run specific failing tests. The current output requires me to to transform the data manually when working.

This saves huge amounts of time and increases the usability of nose.

HaraldNordgren commented 7 years ago

Solves https://github.com/nose-devs/nose/issues/1024

chaoflow commented 7 years ago

@HaraldNordgren I'm all for the result but have some remarks: