Chris Calloway added the comment: > There are at least two ways you could deal with this. You could change the > working directory to the temp directory in setUp() and change it back in > tearDown(). This is a common pattern in the tests [...]
> Alternatively, you could save the temp directory path as an attribute of the > test class, and then include it in your string match prior to calling the > assert method. Although I prefer explicitly testing that the subdirectory paths shows up in the reports and, in the case of the report_partial_closure test, the regex explicitly tests that the "only in" subdirectory is reported correctly, if I were to have to choose between the two options you propose, I would choose decorating the test instance with the strings as that would at least preserve the ability to perform the latter of the two explicit tests I mention and would not be subject to yet another file system point of failure while switching directories (even if that is a common pattern in the tests). assertRegex is new from unittest2 and seems tailor-made for this use case to me. It gets the job done in explicitly correctly in the least amount of code. If you insist that I not use assertRegex for the report test, I will yield to your preferences. However, I would like your blessing to continue with assertRegex in this case. In either event, I still will refactor the patch into separate test methods for the report methods as previously agreed after your continued feedback. And thank you again for your feedback above. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15518> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com