10111: Merge branch 'master' into 10111-collection-labels
[arvados.git] / sdk / python / tests / test_arv_copy.py
1 from __future__ import absolute_import
2 import os
3 import sys
4 import tempfile
5 import unittest
6
7 import arvados.commands.arv_copy as arv_copy
8 from . import arvados_testutil as tutil
9
10 class ArvCopyTestCase(unittest.TestCase, tutil.VersionChecker):
11     def run_copy(self, args):
12         sys.argv = ['arv-copy'] + args
13         return arv_copy.main()
14
15     def test_unsupported_arg(self):
16         with self.assertRaises(SystemExit):
17             self.run_copy(['-x=unknown'])
18
19     def test_version_argument(self):
20         with tutil.redirected_streams(
21                 stdout=tutil.StringIO, stderr=tutil.StringIO) as (out, err):
22             with self.assertRaises(SystemExit):
23                 self.run_copy(['--version'])
24         self.assertVersionOutput(out, err)