summaryrefslogtreecommitdiff
path: root/tests/test_PristineTar.py
diff options
context:
space:
mode:
authorThomas Koch <thomas@koch.ro>2013-01-21 15:50:39 +0100
committerGuido Günther <agx@sigxcpu.org>2013-04-08 07:43:02 +0200
commit3d6b68ae541d6020ff747628b3e44196999e0a50 (patch)
treebb3f94d4f9c0af6eb3a9779dbf6bbee20a512ef0 /tests/test_PristineTar.py
parent92edb4eda14cf4b5fd1514feb7b81aa50456285c (diff)
tests: Use tempfile.mkdtemp to create temp dirs for tests
This puts test dirs below /tmp which often is a tmpfs. All tests include the context module which consolidates tmpdir creation and cleanup, undoes a chdir in teardown and silences log messages.
Diffstat (limited to 'tests/test_PristineTar.py')
-rw-r--r--tests/test_PristineTar.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_PristineTar.py b/tests/test_PristineTar.py
index f1c6411..e837ef8 100644
--- a/tests/test_PristineTar.py
+++ b/tests/test_PristineTar.py
@@ -15,11 +15,12 @@ This testcase creates this reposity:
"""
+from . import context
+
import os
-tmp_dir = os.path.abspath(
- os.path.join(os.path.curdir, 'gbp_%s_test' % __name__))
-repo_dir = os.path.join(tmp_dir, 'repo')
-test_data = os.path.abspath("tests/test_PristineTar_data")
+
+repo_dir = context.new_tmpdir(__name__).join('repo')
+test_data = os.path.join(context.projectdir, "tests/test_PristineTar_data")
def test_create():
"""
@@ -126,8 +127,7 @@ def test_teardown():
"""
Perform the teardown
- >>> import shutil, os
- >>> os.getenv("GBP_TESTS_NOCLEAN") or shutil.rmtree(tmp_dir)
+ >>> context.teardown()
"""
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: