From 9430ee11c59c1662af388ba47c3d91def044a852 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Guido=20G=C3=BCnther?= Date: Mon, 25 Jun 2012 11:27:13 +0200 Subject: [PATCH] Make TestDir testcase use a newly created directory neeeded for the upcoming packagename/version parsing support --- tests/06_test_upstream_source.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/06_test_upstream_source.py b/tests/06_test_upstream_source.py index e88f429..f6c0a44 100644 --- a/tests/06_test_upstream_source.py +++ b/tests/06_test_upstream_source.py @@ -13,13 +13,21 @@ import zipfile from gbp.pkg import UpstreamSource class TestDir(unittest.TestCase): + def setUp(self): + self.tmpdir = tempfile.mkdtemp(prefix='gbp_%s_' % __name__, dir='.') + self.upstream_dir = os.path.join(self.tmpdir, 'test-1.0') + os.mkdir(self.upstream_dir) + def test_directory(self): """Upstream source is a directory""" - source = UpstreamSource('.') + source = UpstreamSource(self.upstream_dir) self.assertEqual(source.is_orig(), False) - self.assertEqual(source.path, '.') - self.assertEqual(source.unpacked, '.') + self.assertEqual(source.path, self.upstream_dir) + self.assertEqual(source.unpacked, self.upstream_dir) + def tearDown(self): + if not os.getenv("GBP_TESTS_NOCLEAN"): + shutil.rmtree(self.tmpdir) class TestTar(unittest.TestCase): """Test if packing tar archives works""" -- 2.7.4