Statistics
| Branch: | Tag: | Revision:

arvados / sdk / python / tests / test_arv_run.py @ 76d9365a

History | View | Annotate | Download (956 Bytes)

1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3

    
4
from __future__ import absolute_import
5
import os
6
import sys
7
import tempfile
8
import unittest
9

    
10
if sys.version_info >= (3, 0):
11
    from io import StringIO
12
else:
13
    from cStringIO import StringIO
14

    
15
import arvados.commands.run as arv_run
16
from . import arvados_testutil as tutil
17

    
18
class ArvRunTestCase(unittest.TestCase):
19
    def run_arv_run(self, args):
20
        sys.argv = ['arv-run'] + args
21
        return arv_run.main()
22

    
23
    def test_unsupported_arg(self):
24
        with self.assertRaises(SystemExit):
25
            self.run_arv_run(['-x=unknown'])
26

    
27
    def test_version_argument(self):
28
        err = StringIO()
29
        out = StringIO()
30
        with tutil.redirected_streams(stdout=out, stderr=err):
31
            with self.assertRaises(SystemExit):
32
                self.run_arv_run(['--version'])
33
        self.assertEqual(out.getvalue(), '')
34
        self.assertRegexpMatches(err.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")