diff options
author | Jon Bernard <jbernard@jbernard.io> | 2019-01-30 23:43:37 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@jbernard.io> | 2019-03-22 16:44:35 -0400 |
commit | 72294dcf14c9c19464442cfbd5f5896b3bb05518 (patch) | |
tree | 264ca8a2b1dda05397189b72ab097ca9b6ed1299 /tests/pathutils.py | |
parent | 5a0789b887d4f93e31084ccbddea956000506530 (diff) | |
download | dotfiles-72294dcf14c9c19464442cfbd5f5896b3bb05518.tar.gz dotfiles-72294dcf14c9c19464442cfbd5f5896b3bb05518.tar.bz2 dotfiles-72294dcf14c9c19464442cfbd5f5896b3bb05518.zip |
Fix remaining issues with pathlib
Diffstat (limited to 'tests/pathutils.py')
-rw-r--r-- | tests/pathutils.py | 22 |
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() |