projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CI: add checks for basic compatibility with muon
[tinc]
/
test
/
integration
/
testlib
/
util.py
diff --git
a/test/integration/testlib/util.py
b/test/integration/testlib/util.py
index
f0849b9
..
344958e
100755
(executable)
--- a/
test/integration/testlib/util.py
+++ b/
test/integration/testlib/util.py
@@
-7,6
+7,7
@@
import random
import string
import socket
import typing as T
import string
import socket
import typing as T
+import tempfile
from pathlib import Path
from . import check
from pathlib import Path
from . import check
@@
-32,6
+33,14
@@
def random_port() -> int:
log.debug("could not bind to random port %d", port, exc_info=ex)
log.debug("could not bind to random port %d", port, exc_info=ex)
+def temp_file(content: str) -> str:
+ """Create a temporary file and write text content into it."""
+ file = tempfile.mktemp()
+ with open(file, "w", encoding="utf-8") as f:
+ f.write(content)
+ return file
+
+
def remove_file(path: T.Union[str, Path]) -> bool:
"""Try to remove file without failing if it does not exist."""
try:
def remove_file(path: T.Union[str, Path]) -> bool:
"""Try to remove file without failing if it does not exist."""
try: