commit: 410818d2c733bd5961d51191083b423ef53761b1
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 21 08:04:33 2020 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 21 08:06:41 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=410818d2
Test /etc/portage/modules portdbapi.auxdbmodule settings
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/tests/dbapi/test_auxdb.py | 50 ++++++++++++++++++++++++
lib/portage/tests/resolver/ResolverPlayground.py | 2 +-
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/lib/portage/tests/dbapi/test_auxdb.py
b/lib/portage/tests/dbapi/test_auxdb.py
new file mode 100644
index 000000000..73fc2b2c3
--- /dev/null
+++ b/lib/portage/tests/dbapi/test_auxdb.py
@@ -0,0 +1,50 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+from __future__ import unicode_literals
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground
+from portage.util.futures import asyncio
+from portage.util.futures.compat_coroutine import coroutine
+
+
+class AuxdbTestCase(TestCase):
+
+ def test_flat_hash_md5(self):
+ self._test_mod('portage.cache.flat_hash.md5_database')
+
+ def test_volatile(self):
+ self._test_mod('portage.cache.volatile.database')
+
+ def test_sqite(self):
+ try:
+ import sqlite3
+ except ImportError:
+ self.skipTest('sqlite3 import failed')
+ self._test_mod('portage.cache.sqlite.database')
+
+ def _test_mod(self, auxdbmodule):
+ ebuilds = {
+ "cat/A-1": {
+ "EAPI": "7"
+ },
+ "cat/B-1": {
+ "EAPI": "7"
+ },
+ }
+
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ user_config={'modules': ('portdbapi.auxdbmodule = %s' %
auxdbmodule,)})
+
+ portdb = playground.trees[playground.eroot]["porttree"].dbapi
+
+ loop = asyncio._wrap_loop()
+ loop.run_until_complete(self._test_mod_async(ebuilds, portdb))
+
+ @coroutine
+ def _test_mod_async(self, ebuilds, portdb):
+
+ for cpv, metadata in ebuilds.items():
+ eapi, = yield portdb.async_aux_get(cpv, ['EAPI'])
+ self.assertEqual(eapi, metadata['EAPI'])
diff --git a/lib/portage/tests/resolver/ResolverPlayground.py
b/lib/portage/tests/resolver/ResolverPlayground.py
index cc3056ab4..d7fbe4390 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -44,7 +44,7 @@ class ResolverPlayground(object):
its work.
"""
- config_files = frozenset(("eapi", "layout.conf", "make.conf",
"package.accept_keywords",
+ config_files = frozenset(("eapi", "layout.conf", "make.conf",
"modules", "package.accept_keywords",
"package.keywords", "package.license", "package.mask",
"package.properties",
"package.provided", "packages",
"package.unmask", "package.use", "package.use.aliases",
"package.use.stable.mask",