Page MenuHome
No OneTemporary

File Metadata

Fri, Jun 5, 10:19 PM

import os
import tempfile
from common_test_class import AbstractPillarTest
class TempDirTest(AbstractPillarTest):
def test_tempfiles_location(self):
# After importing the application, tempfiles should be created in the STORAGE_DIR
storage =['STORAGE_DIR']
self.assertEqual(os.environ['TMP'], storage)
self.assertNotIn('TEMP', os.environ)
self.assertNotIn('TMPDIR', os.environ)
handle, filename = tempfile.mkstemp()
dirname = os.path.dirname(filename)
self.assertEqual(dirname, storage)
tmpfile = tempfile.NamedTemporaryFile()
dirname = os.path.dirname(
self.assertEqual(dirname, storage)

Event Timeline