summaryrefslogtreecommitdiff
path: root/tests/farm
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-18 09:59:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-11-18 09:59:56 -0500
commit2eedae529974aa0eb0aff7bd411b3b9cd2e9e8aa (patch)
treea832d45c21a95015e85ab0098ac3341ac8802020 /tests/farm
parentceb660ca9422ac1b6bcf7d91869f574517e1007d (diff)
downloadpython-coveragepy-git-2eedae529974aa0eb0aff7bd411b3b9cd2e9e8aa.tar.gz
Convert farm/run/run_timid.py to a test_process test
Diffstat (limited to 'tests/farm')
-rw-r--r--tests/farm/run/run_timid.py43
-rw-r--r--tests/farm/run/src/showtrace.py26
2 files changed, 0 insertions, 69 deletions
diff --git a/tests/farm/run/run_timid.py b/tests/farm/run/run_timid.py
deleted file mode 100644
index 56456618..00000000
--- a/tests/farm/run/run_timid.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
-
-# Test that the --timid command line argument properly swaps the tracer
-# function for a simpler one.
-#
-# This is complicated by the fact that the tests are run twice for each
-# version: once with a compiled C-based trace function, and once without
-# it, to also test the Python trace function. So this test has to examine
-# an environment variable set in igor.py to know whether to expect to see
-# the C trace function or not.
-
-import os
-
-# When meta-coverage testing, this test doesn't work, because it finds
-# coverage.py's own trace function.
-if os.environ.get('COVERAGE_COVERAGE', ''):
- skip("Can't test timid during coverage measurement.")
-
-copy("src", "out_timid")
-run("""
- python showtrace.py none
- coverage run showtrace.py regular
- coverage run --timid showtrace.py timid
- """, rundir="out_timid", outfile="showtraceout.txt")
-
-# When running without coverage, no trace function
-# When running timidly, the trace function is always Python.
-contains("out_timid/showtraceout.txt",
- "none None",
- "timid PyTracer",
- )
-
-if os.environ.get('COVERAGE_TEST_TRACER', 'c') == 'c':
- # If the C trace function is being tested, then regular running should have
- # the C function, which registers itself as f_trace.
- contains("out_timid/showtraceout.txt", "regular CTracer")
-else:
- # If the Python trace function is being tested, then regular running will
- # also show the Python function.
- contains("out_timid/showtraceout.txt", "regular PyTracer")
-
-clean("out_timid")
diff --git a/tests/farm/run/src/showtrace.py b/tests/farm/run/src/showtrace.py
deleted file mode 100644
index a3692521..00000000
--- a/tests/farm/run/src/showtrace.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
-
-# Show the current frame's trace function, so that we can test what the
-# command-line options do to the trace function used.
-
-import sys
-
-# Show what the trace function is. If a C-based function is used, then f_trace
-# may be None.
-trace_fn = sys._getframe(0).f_trace
-if trace_fn is None:
- trace_name = "None"
-else:
- # Get the name of the tracer class. Py3k has a different way to get it.
- try:
- trace_name = trace_fn.im_class.__name__
- except AttributeError:
- try:
- trace_name = trace_fn.__self__.__class__.__name__
- except AttributeError:
- # A C-based function could also manifest as an f_trace value
- # which doesn't have im_class or __self__.
- trace_name = trace_fn.__class__.__name__
-
-print("%s %s" % (sys.argv[1], trace_name))