#!/usr/bin/env python
-#-*- coding:utf-8 -*-
+# -*- coding:utf-8 -*-
# Copyright (C) 2010-2018 CEA/DEN
#
from src.salomeTools import Sat
+
class TestCase(unittest.TestCase):
"""Test of the shell command"""
def test_010(self):
# Test the shell command with the --command option
- OK = 'KO'
+ OK = "KO"
tmp_file = "/tmp/test.txt"
sat = Sat("-l " + tmp_file)
-
+
sat.config()
sat_way = sat.cfg.VARS.salometoolsway
-
+
# Execute the shell command
sat.shell("--command ls " + sat_way)
ff.close()
os.remove(tmp_file)
log_files = [line.replace("\n", "") for line in log_files]
-
+
text = open(log_files[2], "r").read()
if "salomeTools.py" in text:
- OK = 'OK'
- self.assertEqual(OK, 'OK')
+ OK = "OK"
+ self.assertEqual(OK, "OK")
def test_020(self):
# Test the shell command with the --command option with a failing command
- OK = 'KO'
+ OK = "KO"
tmp_file = "/tmp/test.txt"
sat = Sat("-l " + tmp_file)
-
+
sat.config()
-
+
# Execute the shell command
res = sat.shell("--command i_fail")
ff.close()
os.remove(tmp_file)
log_files = [line.replace("\n", "") for line in log_files]
-
+
text = open(log_files[2], "r").read()
if "i_fail" in text and res == 1:
- OK = 'OK'
- self.assertEqual(OK, 'OK')
+ OK = "OK"
+ self.assertEqual(OK, "OK")
def test_030(self):
# Test the sat -h shell
OK = "KO"
import shell
-
+
if "Executes the shell command passed as argument" in shell.description():
OK = "OK"
self.assertEqual(OK, "OK")
+
# test launch
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main()
pass