+ def test_version_argument(self):
+ # The argparse version action prints to stderr in Python 2 and stdout
+ # in Python 3.4 and up. Write both to the same stream so the test can pass
+ # in both cases.
+ origerr = sys.stderr
+ origout = sys.stdout
+ sys.stderr = io.StringIO()
+ sys.stdout = sys.stderr
+
+ with self.assertRaises(SystemExit):
+ args = arvados_fuse.command.ArgumentParser().parse_args(['--version'])
+ assertRegex(self, sys.stdout.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")
+ sys.stderr.close()
+ sys.stderr = origerr
+ sys.stdout = origout
+