Skip to content
Snippets Groups Projects
Commit 0ef49334 authored by Guillaume Chanel's avatar Guillaume Chanel
Browse files

Assert shell exits with code 0

parent ecf63d8a
Branches
No related tags found
No related merge requests found
Pipeline #19920 failed
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Test the given TP shell # Test the given TP shell
# #
# Author: David Gonzalez (HEPIA) <david.dg.gonzalez@hesge.ch> # Author: David Gonzalez (HEPIA) <david.dg.gonzalez@hesge.ch>
# Author: Guillaume Chanel <guillaume.chanel@unige.ch>
import sys import sys
import tempfile import tempfile
...@@ -153,6 +154,9 @@ class Shell: ...@@ -153,6 +154,9 @@ class Shell:
raise subprocess.TimeoutExpired('The exit command did not exit the shell after {}s'.format(timeout)) raise subprocess.TimeoutExpired('The exit command did not exit the shell after {}s'.format(timeout))
#TODO: should I check if process is still running at that point (stream closed but process alive ?) #TODO: should I check if process is still running at that point (stream closed but process alive ?)
if self.shell_process.returncode != 0:
raise AssertionError('Shell process exited with an error code ({})'.format(self.shell_process.returncode))
def read_stdout(self): def read_stdout(self):
if self.stdout is not None: if self.stdout is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment