Commit af1f8725 authored by Luke Macken's avatar Luke Macken

Grab the exception code in a way that works on py3 as well.

parent a5df282c
...@@ -32,7 +32,7 @@ class TestCLI(object): ...@@ -32,7 +32,7 @@ class TestCLI(object):
try: try:
main() main()
except SystemExit: except SystemExit:
exit_code = sys.exc_value.code exit_code = sys.exc_info()[1].code
assert exit_code == 1, exit_code assert exit_code == 1, exit_code
def test_list_payloads(self): def test_list_payloads(self):
...@@ -55,7 +55,7 @@ class TestCLI(object): ...@@ -55,7 +55,7 @@ class TestCLI(object):
try: try:
main() main()
except SystemExit: except SystemExit:
exit_code = sys.exc_value.code exit_code = sys.exc_info()[1].code
assert exit_code == 2, exit_code assert exit_code == 2, exit_code
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout = stdout sys.stdout = stdout
...@@ -68,7 +68,7 @@ class TestCLI(object): ...@@ -68,7 +68,7 @@ class TestCLI(object):
try: try:
main() main()
except SystemExit: except SystemExit:
exit_code = sys.exc_value.code exit_code = sys.exc_info()[1].code
assert exit_code == 3, exit_code assert exit_code == 3, exit_code
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout = stdout sys.stdout = stdout
...@@ -81,7 +81,7 @@ class TestCLI(object): ...@@ -81,7 +81,7 @@ class TestCLI(object):
try: try:
main() main()
except SystemExit: except SystemExit:
exit_code = sys.exc_value.code exit_code = sys.exc_info()[1].code
assert exit_code == 4, exit_code assert exit_code == 4, exit_code
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout = stdout sys.stdout = stdout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment