Example #1
0
    def test_user_files(self):
        file_path = '/tmp/test_%s' % os.uname()[1]
        self._rmfile(file_path)

        config.create_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))
        config.clean_user_file(file_path)
        self.assertFalse(os.path.exists(file_path))

        config.create_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))
        with open(file_path, 'w+') as _file:
            _file.write('DATA\n')
        config.clean_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))  # not empty, still here

        self._rmfile(file_path)
Example #2
0
    def test_user_files(self):
        file_path = '/tmp/test_%s' % os.uname()[1]
        self._rmfile(file_path)

        config.create_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))
        config.clean_user_file(file_path)
        self.assertFalse(os.path.exists(file_path))

        config.create_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))
        with open(file_path, 'w+') as _file:
            _file.write('DATA\n')
        config.clean_user_file(file_path)
        self.assertTrue(os.path.exists(file_path))  # not empty, still here

        self._rmfile(file_path)
Example #3
0
 def cleanup_user_exp_files(exp_files):
     """ Delete empty user experiment files """
     for exp_file in exp_files.values():
         config.clean_user_file(exp_file)