11767: Make squeue format output pipe (|) delimited so that it doesn't get
[arvados.git] / services / nodemanager / tests / test_arguments.py
1 #!/usr/bin/env python
2
3 import io
4 import os
5 import sys
6 import tempfile
7 import unittest
8
9 import arvnodeman.launcher as nodeman
10 from . import testutil
11
12 class ArvNodemArgumentsTestCase(unittest.TestCase):
13     def run_nodeman(self, args):
14         return nodeman.main(args)
15
16     def test_unsupported_arg(self):
17         with self.assertRaises(SystemExit):
18             self.run_nodeman(['-x=unknown'])
19
20     def test_version_argument(self):
21         err = io.BytesIO()
22         out = io.BytesIO()
23         with testutil.redirected_streams(stdout=out, stderr=err):
24             with self.assertRaises(SystemExit):
25                 self.run_nodeman(['--version'])
26         self.assertEqual(out.getvalue(), '')
27         self.assertRegexpMatches(err.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")