def test_get_chunk_info_matchfail(self, monkeypatch: MonkeyPatch): def listdir(path): return ["foo", "bar"] scput = SplitCopyPut() scput.scs = MockSplitCopyShared() scput.local_file = "somefile" monkeypatch.setattr("os.listdir", listdir) with raises(SystemExit): scput.get_chunk_info()
def test_get_chunk_info(self, monkeypatch: MonkeyPatch): def listdir(path): return ["somefile_aa", "somefile_ab"] def stat(*args): stat.st_size = 10000 return stat scput = SplitCopyPut() scput.scs = MockSplitCopyShared() scput.local_file = "somefile" monkeypatch.setattr("os.listdir", listdir) monkeypatch.setattr("os.stat", stat) result = scput.get_chunk_info() assert result == [["somefile_aa", 10000], ["somefile_ab", 10000]]