summaryrefslogtreecommitdiff
path: root/test/path.py
blob: 38c0991865a3a10f64b3ab8f70304df5c4aa44bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
import tempfile
import shutil


def temppath(*paths):
    return os.path.join(tempfile.gettempdir(), *paths)


def move(src, dst):
    if os.path.isfile(dst):
        os.remove(dst)
    elif os.path.isdir(dst):
        shutil.rmtree(dst)
    if os.path.exists(src):
        os.rename(src, dst)