bpo-38659: Properly re-intialize module variables in test_enum by ammaraskar · Pull Request #25516 · python/cpython

Previously TestIntEnumConvert and TestStrEnumConvert would end up converting the module level variables from their regular int form to a test.test_enum.X instance after _convert would run. This meant that after a single test ran, the next set of _convert functions would be operating on the enum instances rather than ints. This would cause some tests such as the one involving format to fail when running under a mode that repeatedly runs test such as the refleak finder.

https://bugs.python.org/issue38659