m_safe_load_all.return_value = [{"failure_reason": "reasons"}]
ls.ls("some/archive/div", True)
- @patch("__builtin__.open")
+ @patch("teuthology.ls.open")
@patch("teuthology.ls.get_jobs")
def test_ls_ioerror(self, m_get_jobs, m_open):
m_get_jobs.return_value = ["1", "2"]
with pytest.raises(IOError):
ls.ls("some/archive/dir", True)
- @patch("__builtin__.open")
+ @patch("teuthology.ls.open")
@patch("os.popen")
@patch("os.path.isdir")
@patch("os.path.isfile")
m_isdir.return_value = True
m_popen.return_value = Mock()
cmdline = Mock()
- cmdline.find.return_value = True
- m_open.return_value = cmdline
+ cmdline.find = Mock(return_value=0)
+ m1 = Mock()
+ m2 = Mock()
+ m2.read = Mock(return_value=cmdline)
+ m_open.side_effect = [m1, m2]
ls.print_debug_info("the_job", "job/dir", "some/archive/dir")
@patch("os.path.exists")
@patch("yaml.safe_load")
- @patch("__builtin__.open")
+ @patch("teuthology.misc.open")
def test_merge_configs(self, m_open, m_safe_load, m_exists):
""" Only tests with one yaml file being passed, mainly just to test
the loop logic. The actual merge will be tested in subsequent