def test_mv_to_tmp(self): tmp_dir = TestHelper.mkdir_tmp() TestHelper.mkdir_p(tmp_dir+'/master/0/123') TestHelper.touch(tmp_dir+'/master/0/123/file.parquet') self.fs.dwh_path = tmp_dir dst = self.fs.mv_to_tmp('master', '0/123') self.assertEqual(self.fs.ls_a(dst)[1][0], dst + '/file.parquet')
def test_mv_to_tmp(self): tmp_dir = TestHelper.mkdir_tmp() TestHelper.mkdir_p(tmp_dir + '/master/0/123') TestHelper.touch(tmp_dir + '/master/0/123/file.parquet') self.fs.dwh_path = tmp_dir dst = self.fs.mv_to_tmp('master', '0/123') self.assertEqual(self.fs.ls_a(dst)[1][0], dst + '/file.parquet')
def test_path_exists(self): tmp_dir = TestHelper.mkdir_tmp() TestHelper.mkdir_p(tmp_dir + '/mart/123') self.fs.dwh_path = tmp_dir assert self.fs.path_exists('mart', '') assert self.fs.path_exists('mart', '123') assert not self.fs.path_exists('mart', '12') assert not self.fs.path_exists('mart2', '123')
def test_dirs_in_period(self): mart = TestHelper.random_name() date1 = Date.tz_berlin(2014,4,1) date2 = Date.tz_berlin(2014,4,2) TestHelper.mkdir('/tmp/' + mart) TestHelper.mkdir('/tmp/' + mart + '/' + str(date1.seconds())) dirs = self.fs.dirs_of_period(mart, '', date1.seconds(), date2.seconds()) self.assertEqual(['/tmp/' + mart + '/' + str(date1.seconds())], dirs)
def test_dirs_in_period(self): mart = TestHelper.random_name() date1 = Date.tz_berlin(2014, 4, 1) date2 = Date.tz_berlin(2014, 4, 2) TestHelper.mkdir('/tmp/' + mart) TestHelper.mkdir('/tmp/' + mart + '/' + str(date1.seconds())) dirs = self.fs.dirs_of_period(mart, '', date1.seconds(), date2.seconds()) self.assertEqual(['/tmp/' + mart + '/' + str(date1.seconds())], dirs)
def test_rm_r(self): mart = TestHelper.random_name() TestHelper.mkdir('/tmp/' + mart + '/1/123456') self.fs.rm_r(mart, '1') dir_exists = '/tmp/' + mart + '/1' in self.fs.ls_d(mart, '') assert not dir_exists
def test_ls(self): mart = TestHelper.random_name() TestHelper.mkdir('/tmp/' + mart) TestHelper.touch('/tmp/' + mart + '/filename') self.assertEqual('/tmp/' + mart + '/filename', self.fs.ls(mart, '')[0])