summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-03-18 22:24:53 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-03-18 22:27:41 +0900
commit458e8d6dd03ffa3f7591de8ff496c8453efd9c6d (patch)
tree4687ce4490b37da1b661f0be4d02154c12f403dd /test
parent015ddd4bf03c011d7051590b8bfb89979a52d162 (diff)
downloadsystemd-458e8d6dd03ffa3f7591de8ff496c8453efd9c6d.tar.gz
test-systemd-tmpfiles.py: create global temporary directory
For some unknown reasons, the temporary directory created by the test below is not removed: ``` # Test the case that a valid symlink is in the path. label = 'valid_symlink-deep' test_content('f= {} - - - - ' + label, label, user=user, subpath='/deep/1/2', path_cb=valid_symlink) ``` To keep /tmp clean, let's create the global temprary directory.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-systemd-tmpfiles.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py
index 8b42c66db8..791a88497c 100755
--- a/test/test-systemd-tmpfiles.py
+++ b/test/test-systemd-tmpfiles.py
@@ -28,6 +28,7 @@ except AttributeError:
sys.exit(EXIT_TEST_SKIP)
exe_with_args = sys.argv[1:]
+temp_dir = tempfile.TemporaryDirectory(prefix='test-systemd-tmpfiles.')
def test_line(line, *, user, returncode=EX_DATAERR, extra={}):
args = ['--user'] if user else []
@@ -75,7 +76,7 @@ def test_uninitialized_t():
user=True, returncode=0, extra={'env':{'HOME': os.getenv('HOME')}})
def test_content(line, expected, *, user, extra={}, subpath='/arg', path_cb=None):
- d = tempfile.TemporaryDirectory(prefix='test-systemd-tmpfiles.')
+ d = tempfile.TemporaryDirectory(prefix='test-content.', dir=temp_dir.name)
if path_cb is not None:
path_cb(d.name, subpath)
arg = d.name + subpath