aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pathutils.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/pathutils.py b/tests/pathutils.py
new file mode 100644
index 0000000..87f82af
--- /dev/null
+++ b/tests/pathutils.py
@@ -0,0 +1,22 @@
+# TODO: docstrings
+# XXX: can this move into tests/?
+
+
+def is_file(path):
+ return path.is_file() and not path.is_symlink()
+
+
+def is_link(path):
+ return path.is_file() and path.is_symlink()
+
+
+def mkdir(path):
+ try:
+ path.mkdir(parents=True)
+ except FileExistsError:
+ pass
+
+
+def touch(path):
+ mkdir(path.parent)
+ path.touch()