From 72294dcf14c9c19464442cfbd5f5896b3bb05518 Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Wed, 30 Jan 2019 23:43:37 -0500 Subject: Fix remaining issues with pathlib --- tests/pathutils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/pathutils.py (limited to 'tests/pathutils.py') 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() -- cgit v1.2.3