-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathtest333.py
More file actions
52 lines (42 loc) · 1.6 KB
/
test333.py
File metadata and controls
52 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
[ #476772 ] shutdowns in jython / atexit
"""
import support
import os
def check(filename, result):
f = open(filename)
l = f.readlines()
f.close()
if l != result:
raise support.TestError("Result was wrong: %s" % l)
# Different exit situations in the interpreter.
support.runJython("test333s1.py", output="test333s1.out")
check("test333s1.out", [ "myfunc\n" ])
ret = support.runJython("test333s2.py", output="test333s2.out", expectError=1)
if ret != 42:
raise support.TestError("Return code was wrong: %d" % ret)
check("test333s2.out", [ "myfunc\n" ])
support.runJython("test333s3.py",
output="test333s3.out", error="test333s3.err", expectError=1)
check("test333s3.out", [ "myfunc\n" ])
check("test333s3.err", [
'Traceback (innermost last):\n',
' File "test333s3.py", line 8, in ?\n',
'Exc\n',
])
# Different exit situations in compiled applications.
support.compileJPythonc("test333s1.py", output="test333s1.err")
support.runJava("test333s1", classpath="jpywork", output="test333s1.out")
check("test333s1.out", [ "myfunc\n" ])
support.compileJPythonc("test333s1.py", output="test333s3.err")
support.runJava("test333s1", classpath="jpywork", output="test333s1.out")
check("test333s1.out", [ "myfunc\n" ])
support.compileJPythonc("test333s3.py", output="test333s3.err")
support.runJava("test333s3", classpath="jpywork", output="test333s3.out",
error="test333s3.err", expectError=1)
check("test333s3.out", [ "myfunc\n" ])
f = open("test333s3.err")
lines = f.readlines();
f.close()
if "Exc\n" not in lines:
raise support.TestError("Should raise a 'Exc' exception")