def test__getcontextfile_is_dir(self): if os.path.exists(path_default): shutil.rmtree(path_default) os.mkdir(path_default, 0777) pathfile = os.path.join(path_default, 'directore') os.mkdir(pathfile, 0777) self.assertIsNone( _getcontextfile( pathfile=pathfile, minuteexpire=5, debug=False, ftype='pickle' ) ) shutil.rmtree(path_default)
def test__getcontextfile_file_corrupt(self): if not os.path.exists(path_default): os.mkdir(path_default, 0777) pathfile = os.path.join(path_default, 'corrupt') if os.path.exists(pathfile): os.unlink(pathfile) _setcontextfile( pathfile=pathfile, context=dict(a='1'), ftype='literal' ) self.assertIsNone( _getcontextfile( pathfile=pathfile, minuteexpire=5, debug=False, ftype='pickle' ) ) shutil.rmtree(path_default)
def test_cache_def_invalid_getcontextfile(self): self.assertIsNone(_getcontextfile(pathfile='/xpto/'))