diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-10 19:17:10 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-10 19:17:10 -0700 |
commit | 8e9726b5b0ce5bf07fe970eac4fc8794ddaa9d05 (patch) | |
tree | db1d3bc629f879f9a46c32373987daa4bb0f95af | |
parent | b7fbec5157cbe5a4faaa3d04d3656e354a805e11 (diff) | |
download | portage-8e9726b5b0ce5bf07fe970eac4fc8794ddaa9d05.tar.gz portage-8e9726b5b0ce5bf07fe970eac4fc8794ddaa9d05.tar.bz2 portage-8e9726b5b0ce5bf07fe970eac4fc8794ddaa9d05.zip |
test_fakedbapi: use tempdir for config paths
-rw-r--r-- | pym/portage/tests/dbapi/test_fakedbapi.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pym/portage/tests/dbapi/test_fakedbapi.py b/pym/portage/tests/dbapi/test_fakedbapi.py index ed24782eb..d1ea32d53 100644 --- a/pym/portage/tests/dbapi/test_fakedbapi.py +++ b/pym/portage/tests/dbapi/test_fakedbapi.py @@ -1,6 +1,9 @@ # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import shutil +import tempfile + from portage.dbapi.virtual import fakedbapi from portage.package.ebuild.config import config from portage.tests import TestCase @@ -33,10 +36,14 @@ class TestFakedbapi(TestCase): ("virtual/package-manager", ["virtual/package-manager-0"]), ) - fakedb = fakedbapi(settings=config(config_profile_path="")) - for cpv, metadata in packages: - fakedb.cpv_inject(cpv, metadata=metadata) + tempdir = tempfile.mkdtemp() + try: + fakedb = fakedbapi(settings=config(config_profile_path="", + config_root=tempdir, target_root=tempdir)) + for cpv, metadata in packages: + fakedb.cpv_inject(cpv, metadata=metadata) - for atom, expected_result in match_tests: - result = [] - self.assertEqual( fakedb.match(atom), expected_result ) + for atom, expected_result in match_tests: + self.assertEqual( fakedb.match(atom), expected_result ) + finally: + shutil.rmtree(tempdir) |