Browse Source

Add tests for stdout & stderr in foo_pep333.py example

Yann Weber 4 years ago
parent
commit
c80579af7f
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      foo_pep333.py

+ 9
- 0
foo_pep333.py View File

@@ -1,7 +1,9 @@
1 1
 import sys
2 2
 import os
3 3
 import time
4
+import random
4 5
 from pprint import pformat
6
+random.seed()
5 7
 
6 8
 def entrypoint(env, start_response):
7 9
 	write_body = start_response("200 OK", [('Content-type', 'text/plain')])
@@ -17,4 +19,11 @@ def entrypoint(env, start_response):
17 19
 		if not data:
18 20
 			break
19 21
 	write_body(("Environ data :\n'%s'\n====\n" % pformat(env)).encode())
22
+	print("Hello world !")
23
+	print("False error :D", file=sys.stderr)
24
+	5/0
25
+	time.sleep(random.randint(0,15)/1000)
26
+	#time.sleep(random.randint(0,15)/100)
27
+	#if random.randint(0,100) > 98:
28
+	#	time.sleep(3)
20 29
 	return [b'Hello world !\n']

Loading…
Cancel
Save