11510: Add support for sparse writes to ArvadosFile.
[arvados.git] / sdk / python / tests / test_arv_ws.py
index 5a018273a4d0c8aa6b35970cbb151227083e0a47..2a85e04e87c06067bd7d83773295cf049f747852 100644 (file)
@@ -1,8 +1,14 @@
 #!/usr/bin/env python
 
+import io
+import os
+import sys
+import tempfile
 import unittest
+
 import arvados.errors as arv_error
 import arvados.commands.ws as arv_ws
+import arvados_testutil as tutil
 
 class ArvWsTestCase(unittest.TestCase):
     def run_ws(self, args):
@@ -11,3 +17,12 @@ class ArvWsTestCase(unittest.TestCase):
     def test_unsupported_arg(self):
         with self.assertRaises(SystemExit):
             self.run_ws(['-x=unknown'])
+
+    def test_version_argument(self):
+        err = io.BytesIO()
+        out = io.BytesIO()
+        with tutil.redirected_streams(stdout=out, stderr=err):
+            with self.assertRaises(SystemExit):
+                self.run_ws(['--version'])
+        self.assertEqual(out.getvalue(), '')
+        self.assertRegexpMatches(err.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")