Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[remote_ops] A problem with mktemp on Alpine Linux is fixed#208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[remote_ops] A problem with mktemp on Alpine Linux is fixed
Five 'X' in template is not enough - Alpine returns "mktemp: : Invalid argument" error.Six 'X' is OK.
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedMar 11, 2025
commite47cded2a784bfbc64c9a70aceedfe26f9a3b802
4 changes: 2 additions & 2 deletionstestgres/operations/remote_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -316,7 +316,7 @@ def mkdtemp(self, prefix=None):
- prefix (str): The prefix of the temporary directory name.
"""
if prefix:
command = ["mktemp", "-d", "-t", prefix + "XXXXX"]
command = ["mktemp", "-d", "-t", prefix + "XXXXXX"]
else:
command = ["mktemp", "-d"]

Expand DownExpand Up@@ -344,7 +344,7 @@ def mkstemp(self, prefix=None):
- prefix (str): The prefix of the temporary directory name.
"""
if prefix:
command = ["mktemp", "-t", prefix + "XXXXX"]
command = ["mktemp", "-t", prefix + "XXXXXX"]
else:
command = ["mktemp"]

Expand Down
17 changes: 17 additions & 0 deletionstests/test_local.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
import pytest
import re
import tempfile
import logging

from ..testgres import ExecUtilException
from ..testgres import InvalidOperationException
Expand All@@ -18,6 +19,22 @@ class TestLocalOperations:
def setup(self):
self.operations = LocalOperations()

def test_mkdtemp__default(self):
path = self.operations.mkdtemp()
logging.info("Path is [{0}].".format(path))
assert os.path.exists(path)
os.rmdir(path)
assert not os.path.exists(path)

def test_mkdtemp__custom(self):
C_TEMPLATE = "abcdef"
path = self.operations.mkdtemp(C_TEMPLATE)
logging.info("Path is [{0}].".format(path))
assert os.path.exists(path)
assert C_TEMPLATE in os.path.basename(path)
os.rmdir(path)
assert not os.path.exists(path)

def test_exec_command_success(self):
"""
Test exec_command for successful command execution.
Expand Down
17 changes: 17 additions & 0 deletionstests/test_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
import pytest
import re
import tempfile
import logging

from ..testgres import ExecUtilException
from ..testgres import InvalidOperationException
Expand DownExpand Up@@ -110,6 +111,22 @@ def test_makedirs_failure(self):
with pytest.raises(Exception):
self.operations.makedirs(path)

def test_mkdtemp__default(self):
path = self.operations.mkdtemp()
logging.info("Path is [{0}].".format(path))
assert os.path.exists(path)
os.rmdir(path)
assert not os.path.exists(path)

def test_mkdtemp__custom(self):
C_TEMPLATE = "abcdef"
path = self.operations.mkdtemp(C_TEMPLATE)
logging.info("Path is [{0}].".format(path))
assert os.path.exists(path)
assert C_TEMPLATE in os.path.basename(path)
os.rmdir(path)
assert not os.path.exists(path)

def test_rmdirs(self):
path = self.operations.mkdtemp()
assert os.path.exists(path)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp