I've tried various mock versions we ship and I couldn't find a version where this doesn't happen. 3.14 and 3.15 and 3.16 seem to be affected. To reproduce, have this tox.ini in an empty directory: [tox] envlist = py39 And run from within mock: time tox -l $ mock -r fedora-rawhide-x86_64 shell ... <mock-chroot> sh-5.0# time tox -l py39 real 0m56.269s user 0m0.199s sys 0m0.015s $ mock -r fedora-rawhide-x86_64 shell --enable-network ... <mock-chroot> sh-5.0# time tox -l py39 real 0m2.213s user 0m0.200s sys 0m0.024s Note that tox -l should not create any environments nor download any packages from the network :/ This slows down pyproject-rpm-macros/tox-current-env spec files for up to 2 minutes when built in mock. I cannot wrap my head around this and would like to debug what connection it makes.
I've managed to debug this with https://unix.stackexchange.com/a/503217/196399 (running the command from outside mock). There is a dns query to my hostname, tox calls socket.getfqdn(). https://github.com/tox-dev/tox/blob/3.16.1/src/tox/logs/result.py#L24 I've manged to reproduce the hang with: <mock-chroot> sh-5.0# python3 -c 'import socket; print(socket.getfqdn())'
Tox 3.17+ has a way to workaround this. Assigning to pyproject macros to use the workaround.
https://src.fedoraproject.org/rpms/pyproject-rpm-macros/pull-request/61