summaryrefslogtreecommitdiff
path: root/tests/farm/run/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/farm/run/src')
-rw-r--r--tests/farm/run/src/chdir.py4
-rw-r--r--tests/farm/run/src/showtrace.py23
-rw-r--r--tests/farm/run/src/subdir/placeholder0
-rw-r--r--tests/farm/run/src/xxx8
4 files changed, 35 insertions, 0 deletions
diff --git a/tests/farm/run/src/chdir.py b/tests/farm/run/src/chdir.py
new file mode 100644
index 00000000..6d834924
--- /dev/null
+++ b/tests/farm/run/src/chdir.py
@@ -0,0 +1,4 @@
+import os
+print("Line One")
+os.chdir("subdir")
+print("Line Two")
diff --git a/tests/farm/run/src/showtrace.py b/tests/farm/run/src/showtrace.py
new file mode 100644
index 00000000..e97412e0
--- /dev/null
+++ b/tests/farm/run/src/showtrace.py
@@ -0,0 +1,23 @@
+# 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))
diff --git a/tests/farm/run/src/subdir/placeholder b/tests/farm/run/src/subdir/placeholder
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/farm/run/src/subdir/placeholder
diff --git a/tests/farm/run/src/xxx b/tests/farm/run/src/xxx
new file mode 100644
index 00000000..8f727f08
--- /dev/null
+++ b/tests/farm/run/src/xxx
@@ -0,0 +1,8 @@
+# This is a python file though it doesn't look like it, like a main script.
+a = b = c = d = 0
+a = 3
+b = 4
+if not b:
+ c = 6
+d = 7
+print("xxx: %r %r %r %r" % (a, b, c, d))