Revision 1,
737 bytes
checked in by mmamonski, 14 years ago
(diff) |
Torque/PBS DRMAA initial commit
|
Rev | Line | |
---|
[1] | 1 | |
---|
| 2 | import subprocess |
---|
| 3 | from os.path import join, dirname |
---|
| 4 | |
---|
| 5 | valid_outputs = [ |
---|
| 6 | """\ |
---|
| 7 | try |
---|
| 8 | after try |
---|
| 9 | """, |
---|
| 10 | |
---|
| 11 | """\ |
---|
| 12 | try |
---|
| 13 | else |
---|
| 14 | finally |
---|
| 15 | """, |
---|
| 16 | |
---|
| 17 | """\ |
---|
| 18 | try |
---|
| 19 | except: Invalid argument value. |
---|
| 20 | finally |
---|
| 21 | """, |
---|
| 22 | |
---|
| 23 | """\ |
---|
| 24 | runner: before |
---|
| 25 | inner try |
---|
| 26 | inner finally |
---|
| 27 | except: Invalid argument value. |
---|
| 28 | finally |
---|
| 29 | runner: except: Invalid argument value. |
---|
| 30 | """, |
---|
| 31 | |
---|
| 32 | """\ |
---|
| 33 | runner: before |
---|
| 34 | except: Invalid argument value. |
---|
| 35 | finally |
---|
| 36 | runner: except: Unexpected or internal error. |
---|
| 37 | """, |
---|
| 38 | ] |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | def check_output(test_no): |
---|
| 42 | executable = join(dirname(__file__), "test_exception") |
---|
| 43 | p = subprocess.Popen( |
---|
| 44 | args=[executable, str(test_no)], |
---|
| 45 | stdout=subprocess.PIPE, |
---|
| 46 | ) |
---|
| 47 | output = p.communicate()[0] |
---|
| 48 | assert output == valid_outputs[test_no] |
---|
| 49 | |
---|
| 50 | def test_exception(): |
---|
| 51 | for i in range(5): |
---|
| 52 | yield check_output, i |
---|
| 53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.