Exemple #1
0
 def test0011_main_input_case_error(self):
     # 스크립트에서 요구한 파라메터 개수가 맞지 않을때 에러
     outfile = 'stderr.txt'
     try:
         r = main('--python_file', SAMPLE_SCRIPT_1, '-a1', '-a2',
                  '--errfile', outfile)
         self.assertEqual(r, 1)
     finally:
         if os.path.exists(outfile):
             os.remove(outfile)
Exemple #2
0
 def test0012_main_input_case_error(self):
     # 키워드 파라메터가 정의되어 있지 않은 상태에서 사용
     outfile = 'stderr.txt'
     try:
         # with self.assertRaises(TypeError):
         r = main('--python_file', SAMPLE_SCRIPT_1, '-a1', '-a2', '-a3',
                  '-k abc=4', '--errfile', outfile)
         self.assertEqual(r, 1)
     finally:
         if os.path.exists(outfile):
             os.remove(outfile)
Exemple #3
0
 def test0031_detail_error(self):
     # 키워드 사용, 같은 이름의 변수가 있으면 해당 변수에 대입
     outfile = 'stderr.txt'
     try:
         r = main('--python_file', SAMPLE_SCRIPT_11, '-a1', '-a2', '-a3',
                  '--outfile', outfile)
         self.assertEqual(r, 1)
         with open(outfile, encoding='utf-8') as ifp:
             rs = ifp.read()
             print(rs)
     finally:
         if os.path.exists(outfile):
             os.remove(outfile)
Exemple #4
0
 def test0013_main_input_case(self):
     # 키워드 사용, 같은 이름의 변수가 있으면 해당 변수에 대입
     outfile = 'stdout.txt'
     try:
         r = main('--python_file', SAMPLE_SCRIPT_2, '-a1', '-a2',
                  '-k abc=4', '-k c=3', '--outfile', outfile)
         self.assertEqual(r, 0)
         with open(outfile, encoding='utf-8') as ifp:
             rs = ifp.read()
             print(rs)
     finally:
         if os.path.exists(outfile):
             os.remove(outfile)
Exemple #5
0
    def test0010_main_input_case(self):
        outfile = 'stdout.txt'
        expect = "('1', '2', '3')"
        try:
            r = main('--python_file', SAMPLE_SCRIPT_1, '-a1', '-a2', '-a3',
                     '--outfile', outfile)
            self.assertTrue(r == 0)
            with open(outfile, encoding='utf-8') as ifp:
                rs = ifp.read()
        finally:
            if os.path.exists(outfile):
                os.remove(outfile)

        self.assertEqual(rs, expect)
Exemple #6
0
"""
====================================
 :mod:`argoslabs.demo.helloworld`
====================================
.. moduleauthor:: Jerry Chae <*****@*****.**>
.. note:: ARGOS-LABS License

Description
===========
ARGOS LABS plugin module demo helloworld
"""

################################################################################
import sys
from alabs.common.util.vvargs import ArgsError, ArgsExit
from argoslabs.demo.run_python_script import main

################################################################################
if __name__ == '__main__':
    try:
        main()
    except ArgsError as err:
        sys.stderr.write('Error: %s\nPlease -h to print help\n' % str(err))
    except ArgsExit as _:
        pass