From: Gilles DAVID Date: Mon, 13 Feb 2023 13:35:23 +0000 (+0100) Subject: Use tempfile.mkdtemp to create temporary directory X-Git-Tag: V9_11_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f6d21d315cb1d6889eb0cff04e5b99cd6937413;p=modules%2Fyacs.git Use tempfile.mkdtemp to create temporary directory The function is cross-platform. Moreover, the variable LOGNAME does not exist in a Docker container --- diff --git a/src/pmml/pmml_swig/PMMLBasicsTest.py b/src/pmml/pmml_swig/PMMLBasicsTest.py index 38a0945f9..3cbe2a265 100644 --- a/src/pmml/pmml_swig/PMMLBasicsTest.py +++ b/src/pmml/pmml_swig/PMMLBasicsTest.py @@ -27,21 +27,13 @@ import unittest import os import shutil import platform +import tempfile class PMMLBasicsTest(unittest.TestCase): def setUp(self): self.resourcesDir = ".." + os.sep + "Test" + os.sep + "samples" + os.sep ; - if platform.system() == "Windows" : - self.tmpDir = os.environ['TMP'] # %TMP% does exist on WINDOWS - else: - self.tmpDir = os.sep + "tmp" + os.sep + os.environ['LOGNAME'] + os.sep ; - self.tmpDir += "PmmlUnitTest"; - self.tmpDir += os.sep ; - if ( not os.path.exists(self.tmpDir) ): - os.makedirs(self.tmpDir); - pass - pass + self.tmpDir = tempfile.mkdtemp(suffix="PmmlUnitTest") def tearDown(self): if ( os.path.exists(self.tmpDir) ):