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.
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 []
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