[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Add sitecustomize.py for running parallelized coverage tests.



commit 00b4ed73995f52ff054be08f5c26b8796aed17aa
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Nov 19 03:51:12 2013 +0000

    Add sitecustomize.py for running parallelized coverage tests.
---
 lib/bridgedb/sitecustomize.py |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/lib/bridgedb/sitecustomize.py b/lib/bridgedb/sitecustomize.py
new file mode 100644
index 0000000..264e5e1
--- /dev/null
+++ b/lib/bridgedb/sitecustomize.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+"""sitecustomize â?? Handles potential loading of extra code when Python starts.
+
+**Module Usage:**
+
+This is normally (this seems not to work with Twisted, for as-of-yet unknown
+reasons) useful for using :mod:`coverage` to measure code execution in spawned
+subprocesses in the following way:
+
+ 1. Set the environment variable ``COVERAGE_PROCESS_START`` to the absolute
+    path of the coverage config file. If you are in the top-level of the
+    bridgedb repo, do:
+
+        $ export COVERAGE_PROCESS_START="${PWD}/.coveragerc"
+
+ 2. In that coverage config file, in the ``[run]`` section, set 
+    ``parallel = True``.
+
+ 3. Run coverage. From the top-level of the bridgedb repo, try doing:
+
+        $ make reinstall && \
+            coverage run $(which trial) ./lib/bridgedb/test/test_* && \
+            coverage combine && coverage report && coverage html
+
+If ``COVERAGE_PROCESS_START`` is not set, this code does nothing,
+``[run] parallel`` should be set to ``False``, and coverage can be run by
+leaving out the ``coverage combine`` portion of the above command.
+
+To view the output HTML coverage data, open
+``path/to/bridgedb_repo/doc/coverage_html/index.html`` in a browser.
+"""
+
+import coverage
+coverage.process_startup()



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits