mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
start functional testing
This commit is contained in:
parent
d6be2fb44c
commit
fbf89687cc
2 changed files with 49 additions and 0 deletions
18
tests/support.py
Normal file
18
tests/support.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from contextlib import contextmanager
|
||||
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
|
||||
|
||||
@contextmanager
|
||||
def temporary_folder():
|
||||
"""creates a temporary folder, return it and delete it afterwards.
|
||||
|
||||
This allows to do something like this in tests:
|
||||
|
||||
>>> with temporary_folder() as d:
|
||||
# do whatever you want
|
||||
"""
|
||||
tempdir = mkdtemp()
|
||||
yield tempdir
|
||||
rmtree(tempdir)
|
||||
Loading…
Add table
Add a link
Reference in a new issue