File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ def mkdtemp(self, prefix=None):
316316 - prefix (str): The prefix of the temporary directory name.
317317 """
318318 if prefix :
319- command = ["mktemp" , "-d" , "-t" , prefix + "XXXXX " ]
319+ command = ["mktemp" , "-d" , "-t" , prefix + "XXXXXX " ]
320320 else :
321321 command = ["mktemp" , "-d" ]
322322
@@ -344,7 +344,7 @@ def mkstemp(self, prefix=None):
344344 - prefix (str): The prefix of the temporary directory name.
345345 """
346346 if prefix :
347- command = ["mktemp" , "-t" , prefix + "XXXXX " ]
347+ command = ["mktemp" , "-t" , prefix + "XXXXXX " ]
348348 else :
349349 command = ["mktemp" ]
350350
Original file line number Diff line number Diff line change 44import pytest
55import re
66import tempfile
7+ import logging
78
89from ..testgres import ExecUtilException
910from ..testgres import InvalidOperationException
@@ -18,6 +19,22 @@ class TestLocalOperations:
1819 def setup (self ):
1920 self .operations = LocalOperations ()
2021
22+ def test_mkdtemp__default (self ):
23+ path = self .operations .mkdtemp ()
24+ logging .info ("Path is [{0}]." .format (path ))
25+ assert os .path .exists (path )
26+ os .rmdir (path )
27+ assert not os .path .exists (path )
28+
29+ def test_mkdtemp__custom (self ):
30+ C_TEMPLATE = "abcdef"
31+ path = self .operations .mkdtemp (C_TEMPLATE )
32+ logging .info ("Path is [{0}]." .format (path ))
33+ assert os .path .exists (path )
34+ assert C_TEMPLATE in os .path .basename (path )
35+ os .rmdir (path )
36+ assert not os .path .exists (path )
37+
2138 def test_exec_command_success (self ):
2239 """
2340 Test exec_command for successful command execution.
Original file line number Diff line number Diff line change 44import pytest
55import re
66import tempfile
7+ import logging
78
89from ..testgres import ExecUtilException
910from ..testgres import InvalidOperationException
@@ -110,6 +111,22 @@ def test_makedirs_failure(self):
110111 with pytest .raises (Exception ):
111112 self .operations .makedirs (path )
112113
114+ def test_mkdtemp__default (self ):
115+ path = self .operations .mkdtemp ()
116+ logging .info ("Path is [{0}]." .format (path ))
117+ assert os .path .exists (path )
118+ os .rmdir (path )
119+ assert not os .path .exists (path )
120+
121+ def test_mkdtemp__custom (self ):
122+ C_TEMPLATE = "abcdef"
123+ path = self .operations .mkdtemp (C_TEMPLATE )
124+ logging .info ("Path is [{0}]." .format (path ))
125+ assert os .path .exists (path )
126+ assert C_TEMPLATE in os .path .basename (path )
127+ os .rmdir (path )
128+ assert not os .path .exists (path )
129+
113130 def test_rmdirs (self ):
114131 path = self .operations .mkdtemp ()
115132 assert os .path .exists (path )
You can’t perform that action at this time.
0 commit comments