Skip to content

Commit fae81a1

Browse files
committed
finally fix the tempdir test
1 parent 0b122c9 commit fae81a1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

python/test/test_cdo.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,13 +832,19 @@ def test_config(self):
832832
self.assertEqual({'has-cgribex': 'yes', 'has-cmor': 'no', 'has-ext': 'yes', 'has-grb': 'yes', 'has-grb1': 'yes', 'has-grb2': 'yes', 'has-hdf5': 'yes', 'has-ieg': 'yes', 'has-nc': 'yes', 'has-nc2': 'yes', 'has-nc4': 'yes', 'has-nc4c': 'yes', 'has-nc5': 'yes', 'has-openmp': 'yes', 'has-proj': 'yes', 'has-srv': 'yes', 'has-threads': 'yes', 'has-wordexp': 'yes'},
833833
cdo.config)
834834
else:
835-
self.assertEqual({'has-cgribex': 'yes', 'has-cmor': 'no', 'has-ext': 'yes', 'has-grb': 'yes', 'has-grb1': 'yes', 'has-grb2': 'yes', 'has-hdf5': 'yes', 'has-ieg': 'yes', 'has-nc': 'yes', 'has-nc2': 'yes', 'has-nc4': 'yes', 'has-nc4c': 'yes', 'has-nc5': 'yes', 'has-openmp': 'yes', 'has-proj': 'yes', 'has-srv': 'yes', 'has-threads': 'yes', 'has-wordexp': 'yes', 'has-nczarr': 'yes', 'has-magics': 'yes'},
835+
self.assertEqual({'has-cgribex': 'yes', 'has-cmor': 'no', 'has-ext': 'yes', 'has-grb': 'yes', 'has-grb1': 'yes', 'has-grb2': 'yes', 'has-hdf5': 'yes', 'has-ieg': 'yes', 'has-nc': 'yes', 'has-nc2': 'yes', 'has-nc4': 'yes', 'has-nc4c': 'yes', 'has-nc5': 'yes', 'has-openmp': 'yes', 'has-proj': 'yes', 'has-srv': 'yes', 'has-threads': 'yes', 'has-wordexp': 'yes', 'has-nczarr': 'yes', 'has-magics': 'yes', 'has-hirlam_extensions': 'no'},
836836
cdo.config)
837837

838838
def test_system_tempdir(self):
839-
# automatic path
840-
tempPath = tempfile.gettempdir()
841-
cdo = Cdo()
839+
# system tempdir migh be cluttered with other stuff, so lets use a
840+
# private directory
841+
import tempfile
842+
tempfile.tempdir = os.path.abspath('.')
843+
844+
# create and use local tempdir
845+
tempPath = tempfile.mkdtemp()
846+
cdo = Cdo(tempdir=tempPath)
847+
842848
cdo.topo('r10x10',options = '-f nc')
843849
self.assertEqual(1,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
844850
cdo.topo('r10x10',options = '-f nc')

0 commit comments

Comments
 (0)