Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add -prof tox environment #9293

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9293.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add profiling test environment.
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ setenv =
passenv = *

commands =
# can be invoked by adding -prof to any environment (e.g. 'py36-postgres-prof'), does not work with '-j X'
prof: python -m cProfile -o "{envname}.cprof" "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}

# the "env" invocation enables coverage checking for sub-processes. This is
# particularly important when running trial with `-j`, since that will make
# it run tests in a subprocess, whose coverage would otherwise not be
Expand All @@ -76,7 +79,7 @@ commands =
#
# keep this in sync with the copy in `testenv:py35-old`.
#
/usr/bin/env COVERAGE_PROCESS_START={toxinidir}/.coveragerc "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
!prof: /usr/bin/env COVERAGE_PROCESS_START={toxinidir}/.coveragerc "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}

# As of twisted 16.4, trial tries to import the tests as a package (previously
# it loaded the files explicitly), which means they need to be on the
Expand Down