def test_windowsish_dir(self): target = self.target_cls(r'''C:\my\folder''' + "\\") pattern = r'''C:\\my\\folder-luigi-tmp-\d{10}''' + r"\\" with target.temporary_path() as tmp_path: assert re.match(pattern, tmp_path) self.fs.rename_dont_move.assert_called_once_with(tmp_path, target.path)
def test_creates_dir_for_dir(self): target = self.target_cls('/my/dir/is/awesome/') with target.temporary_path(): self.fs.mkdir.assert_called_once_with('/my/dir/is', parents=True, raise_if_exists=False)
def test_hadoopish_dir(self): target = self.target_cls(r'''hdfs:///user/arash/myfile.uids''') with target.temporary_path() as tmp_path: assert re.match( r'''hdfs:///user/arash/myfile.uids-luigi-tmp-\d{10}''', tmp_path) self.fs.rename_dont_move.assert_called_once_with(tmp_path, target.path)
def test_file_in_current_dir(self): target = self.target_cls('foo.txt') with target.temporary_path() as tmp_path: self.fs.mkdir.assert_not_called() # there is no dir to create self.fs.rename_dont_move.assert_called_once_with(tmp_path, target.path)
def test_hadoopish_dir(self): target = self.target_cls(r'''hdfs:///user/arash/myfile.uids''') with target.temporary_path() as tmp_path: assert re.match(r'''hdfs:///user/arash/myfile.uids-luigi-tmp-\d{10}''', tmp_path) self.fs.rename_dont_move.assert_called_once_with(tmp_path, target.path)