Python print name of a unit test function in setup
python, unit-testing
Solution
Testcases have a `self.id()` method that returns the current `TestClassName.testMethodName`.
The method uses `self._testMethodName` to build that string; you could use that attribute but the name of the attribute does flag it as internal. Relying on the attribute being there may not work in all Python versions.
Problem
After reading How to get the function name as string in Python? I wondered if it is somehow possible to put a logging statement into one of the ``` def setUp(self): ... def tearDown(self): ... ``` and print the name of the current test function.