subunit: Update to latest upstream version.
[metze/samba/wip.git] / lib / subunit / python / subunit / tests / sample-script.py
index 223d2f5d9ff91ff1d0b46a17482b318850ff481c..91838f6d6fb3d24356f63947bb598294c0b4f11d 100755 (executable)
@@ -1,11 +1,21 @@
 #!/usr/bin/env python
 import sys
-print "test old mcdonald"
-print "success old mcdonald"
-print "test bing crosby"
-print "failure bing crosby ["
-print "foo.c:53:ERROR invalid state"
-print "]"
-print "test an error"
-print "error an error"
+if sys.platform == "win32":
+    import msvcrt, os
+    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+if len(sys.argv) == 2:
+    # subunit.tests.test_test_protocol.TestExecTestCase.test_sample_method_args 
+    # uses this code path to be sure that the arguments were passed to
+    # sample-script.py
+    print("test fail")
+    print("error fail")
+    sys.exit(0)
+print("test old mcdonald")
+print("success old mcdonald")
+print("test bing crosby")
+print("failure bing crosby [")
+print("foo.c:53:ERROR invalid state")
+print("]")
+print("test an error")
+print("error an error")
 sys.exit(0)