11209: Test using ./bin/arv-mount from source dir.
[arvados.git] / sdk / python / tests / test_arv_run.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import io
5 import os
6 import sys
7 import tempfile
8 import unittest
9
10 import arvados.commands.run as arv_run
11 import arvados_testutil as tutil
12
13 class ArvRunTestCase(unittest.TestCase):
14     def run_arv_run(self, args):
15         sys.argv = ['arv-run'] + args
16         return arv_run.main()
17
18     def test_unsupported_arg(self):
19         with self.assertRaises(SystemExit):
20             self.run_arv_run(['-x=unknown'])
21
22     def test_version_argument(self):
23         err = io.BytesIO()
24         out = io.BytesIO()
25         with tutil.redirected_streams(stdout=out, stderr=err):
26             with self.assertRaises(SystemExit):
27                 self.run_arv_run(['--version'])
28         self.assertEqual(out.getvalue(), '')
29         self.assertRegexpMatches(err.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")