File tree 3 files changed +36
-2
lines changed
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):
316
316
- prefix (str): The prefix of the temporary directory name.
317
317
"""
318
318
if prefix :
319
- command = ["mktemp" , "-d" , "-t" , prefix + "XXXXX " ]
319
+ command = ["mktemp" , "-d" , "-t" , prefix + "XXXXXX " ]
320
320
else :
321
321
command = ["mktemp" , "-d" ]
322
322
@@ -344,7 +344,7 @@ def mkstemp(self, prefix=None):
344
344
- prefix (str): The prefix of the temporary directory name.
345
345
"""
346
346
if prefix :
347
- command = ["mktemp" , "-t" , prefix + "XXXXX " ]
347
+ command = ["mktemp" , "-t" , prefix + "XXXXXX " ]
348
348
else :
349
349
command = ["mktemp" ]
350
350
Original file line number Diff line number Diff line change 4
4
import pytest
5
5
import re
6
6
import tempfile
7
+ import logging
7
8
8
9
from ..testgres import ExecUtilException
9
10
from ..testgres import InvalidOperationException
@@ -18,6 +19,22 @@ class TestLocalOperations:
18
19
def setup (self ):
19
20
self .operations = LocalOperations ()
20
21
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
+
21
38
def test_exec_command_success (self ):
22
39
"""
23
40
Test exec_command for successful command execution.
Original file line number Diff line number Diff line change 4
4
import pytest
5
5
import re
6
6
import tempfile
7
+ import logging
7
8
8
9
from ..testgres import ExecUtilException
9
10
from ..testgres import InvalidOperationException
@@ -110,6 +111,22 @@ def test_makedirs_failure(self):
110
111
with pytest .raises (Exception ):
111
112
self .operations .makedirs (path )
112
113
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
+
113
130
def test_rmdirs (self ):
114
131
path = self .operations .mkdtemp ()
115
132
assert os .path .exists (path )
You can’t perform that action at this time.
0 commit comments