python3.spec skips test_distutils and test_bdist_rpm. The whole test files shouldn't be skipped, but only failing test methods should be fixed. Obviously, the best would be to fix the tests upstream.
I was once told that running rpmbuild from withing rpmbuild is dangerous. I've never actually seen it blow up, so consider this just a note.
> I was once told that running rpmbuild from withing rpmbuild is dangerous. If it's the case, we can skip the test if WITHIN_PYTHON_RPM_BUILD env var is set using our @unittest._skipInRpmBuild(reason) decorator. But I would prefer to put this decorator upstream rather than maintaining such code downstream.
Let's focus on moving this decorator upstream and changing it to check RPM_BUILD_ROOT instead. The custom variable is just weird.
About WITHIN_PYTHON_RPM_BUILD, I proposed a change to no longer skip RecvmsgGenericStreamTests.testRecvmsgEOF() of test_socket: https://src.fedoraproject.org/rpms/python3/pull-request/94
And I wrote the following PR to "Reenable test_posix.test_fs_holes()": https://src.fedoraproject.org/rpms/python3/pull-request/95
Scratch build with the 2 tests reenabled: https://koji.fedoraproject.org/koji/taskinfo?taskID=34213261
Sine the scratchbuild was successful, I proposed a PR to simply reenable the two tests: https://src.fedoraproject.org/rpms/python38/pull-request/24
Fixed in python38 master. https://src.fedoraproject.org/rpms/python38/pull-request/25