1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
11 class MkdirDashPTest(unittest.TestCase):
14 os.path.mkdir('./tmp')
19 os.unlink('./tmp/bar')
25 arvados.util.mkdir_dash_p('./tmp/foo')
26 with open('./tmp/bar', 'wb') as f:
28 self.assertRaises(OSError, arvados.util.mkdir_dash_p, './tmp/bar')
31 class RunCommandTestCase(unittest.TestCase):
32 def test_success(self):
33 stdout, stderr = arvados.util.run_command(['echo', 'test'],
34 stderr=subprocess.PIPE)
35 self.assertEqual("test\n".encode(), stdout)
36 self.assertEqual("".encode(), stderr)
38 def test_failure(self):
39 with self.assertRaises(arvados.errors.CommandFailedError):
40 arvados.util.run_command(['false'])