Provided that there is a directory structure like the following in the same directory as the test file, the shell command below should show similar output.
❯ tree a
a
└── b
├── approved
│ └── text.xml
├── empty\ file.json
├── received
│ └── text.xml
└── text.json
3 directories, 4 files
❯ nosetests test_multiple_files_same_asserts_using_meta_programming.py --verbosity=3 --rednose
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
test_compare_to_approved_b_empty_file (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests) ... FAILED
test_compare_to_approved_b_text (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests) ... passed
test_one_specific_file (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests) ... skipped
test_should_produce_valid_xml_b_empty_file (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests) ... passed
test_should_produce_valid_xml_b_text (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests) ... passed
-----------------------------------------------------------------------------
1) FAIL: test_compare_to_approved_b_empty_file (test.test_multiple_files_same_asserts_using_meta_programming.JsonToXmlConversionApprovedFileComparisonTests)
Traceback (most recent call last):
test_multiple_files_same_asserts_using_meta_programming.py line 70 in test_func
enclosed_func(self, enclosed_file_path)
test_multiple_files_same_asserts_using_meta_programming.py line 138 in compare_to_approved
json_input_path
AssertionError: no approved file to compare against for a/b/empty file.json
-------------------- >> begin captured stdout << ---------------------
('no approved file or error reading it', "[Errno 2] No such file or directory: 'a/b/approved/empty file.xml'")
--------------------- >> end captured stdout << ----------------------
-----------------------------------------------------------------------------
5 tests run in 0.0 seconds.
1 FAILED, 1 skipped (3 tests passed)
Notice that a test is named test_compare_to_approved_b_text
, so the metaclass took the name of the method doing the assertions (compare_to_approved
) and combined it with the file that it found (a/b/text.json
) to make a descriptive test name.