How to profile tox?

Viewed 92

I run a particular test-case via tox:

tox -e myenv foo.tests.test_foo.SomeTestCase

This takes 30 seconds.

The test itself is very simple and fast. But there seem to be a lot happening before the test starts to run.

How can I trace/profile the things which happen before the test runs?

Profiling only tox won't help I guess, because tox does not do much. Tox spawns subprocesses which take too long.

1 Answers

tox 4 prints out timestamps as it does the job when passed two level of verbosity. So my advice is to install tox 4 and then do tox -vvv r -e myenv --foo.tests.test_foo.SomeTestC.

PS. A likely big you could do is by enabling wheel build over sdist builds (supported only in tox 4) as installing a sdist is very expensive currently with pip due to needing to set up an isolated build environment:

[testenv]
package = wheel
# below settings only applies if you don't have a c extension
wheel_build_env = .pkg

PS. I'm the tox author/maintainer.

Related