12934: Add .keep via manifest manipulation instead of creating real files
[arvados.git] / services / nodemanager / tests / test_arguments.py
1 #!/usr/bin/env python
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 import io
7 import os
8 import sys
9 import tempfile
10 import unittest
11
12 import arvnodeman.launcher as nodeman
13 from . import testutil
14
15 class ArvNodemArgumentsTestCase(unittest.TestCase):
16     def run_nodeman(self, args):
17         return nodeman.main(args)
18
19     def test_unsupported_arg(self):
20         with self.assertRaises(SystemExit):
21             self.run_nodeman(['-x=unknown'])
22
23     def test_version_argument(self):
24         err = io.BytesIO()
25         out = io.BytesIO()
26         with testutil.redirected_streams(stdout=out, stderr=err):
27             with self.assertRaises(SystemExit):
28                 self.run_nodeman(['--version'])
29         self.assertEqual(out.getvalue(), '')
30         self.assertRegexpMatches(err.getvalue(), "[0-9]+\.[0-9]+\.[0-9]+")