Move check_or_create_dir to the utils module.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from sigal.utils import copy
|
||||
from sigal.utils import copy, check_or_create_dir
|
||||
|
||||
CURRENT_DIR = os.path.dirname(__file__)
|
||||
SAMPLE_DIR = os.path.join(CURRENT_DIR, 'sample')
|
||||
@@ -19,3 +19,16 @@ def test_copy(tmpdir):
|
||||
dst = str(tmpdir.join(filename))
|
||||
copy(src, dst, symlink=True)
|
||||
assert os.path.islink(dst)
|
||||
assert os.readlink(dst) == src
|
||||
|
||||
filename = 'exo20101028-b-full.jpg'
|
||||
src = os.path.join(SAMPLE_DIR, 'pictures', 'dir2', filename)
|
||||
copy(src, dst, symlink=True)
|
||||
assert os.path.islink(dst)
|
||||
assert os.readlink(dst) == src
|
||||
|
||||
|
||||
def test_check_or_create_dir(tmpdir):
|
||||
path = str(tmpdir.join('new_directory'))
|
||||
check_or_create_dir(path)
|
||||
assert os.path.isdir(path)
|
||||
|
||||
Reference in New Issue
Block a user