Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.default_cache_root = download.get_cache_root()
self.temp_dir = tempfile.mkdtemp()
download.set_cache_root(self.temp_dir)
self.patcher = mock.patch('lineflow.datasets.text_classification.sys.maxsize',
int(sys.float_info.max))
self.patcher.start()
def setUp(self):
self.default_cache_root = download.get_cache_root()
self.temp_file_desc, self.temp_file_name = tempfile.mkstemp()
download.set_cache_root(self.temp_file_name)
self.dir_path = tempfile.mkdtemp()
def setUp(self):
self.default_cache_root = download.get_cache_root()
self.temp_dir = tempfile.mkdtemp()
download.set_cache_root(self.temp_dir)
def tearDown(self):
download.set_cache_root(self.default_cache_root)
shutil.rmtree(self.temp_dir)
def tearDown(self):
download.set_cache_root(self.default_cache_root)
shutil.rmtree(self.temp_dir)
def test_set_cache_root(self):
orig_root = download.get_cache_root()
new_root = '/tmp/cache'
try:
download.set_cache_root(new_root)
self.assertEqual(download.get_cache_root(), new_root)
finally:
download.set_cache_root(orig_root)
def tearDown(self):
download.set_cache_root(self.default_cache_root)
shutil.rmtree(self.temp_dir)
def setUp(self):
self.default_cache_root = download.get_cache_root()
self.temp_dir = tempfile.mkdtemp()
download.set_cache_root(self.temp_dir)
def tearDown(self):
download.set_cache_root(self.default_cache_root)
shutil.rmtree(self.temp_dir)