diff options
author | Zac Medico <zmedico@gentoo.org> | 2019-10-18 18:32:45 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2019-10-18 18:36:15 -0700 |
commit | ab481a27e3a672ec762140f9d7cc6be883665a7b (patch) | |
tree | 2c80bf045c4441d9c29e1743229d4b2b7ee89bbb /lib/portage/tests | |
parent | asyncio.start_unix_server: suppress DeprecationWarning for loop argument (diff) | |
download | portage-ab481a27e3a672ec762140f9d7cc6be883665a7b.tar.gz portage-ab481a27e3a672ec762140f9d7cc6be883665a7b.tar.bz2 portage-ab481a27e3a672ec762140f9d7cc6be883665a7b.zip |
testEbuildFetch: add mirror support
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/portage/tests')
-rw-r--r-- | lib/portage/tests/ebuild/test_fetch.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/portage/tests/ebuild/test_fetch.py b/lib/portage/tests/ebuild/test_fetch.py index ac45f8720..c0a76b701 100644 --- a/lib/portage/tests/ebuild/test_fetch.py +++ b/lib/portage/tests/ebuild/test_fetch.py @@ -29,6 +29,13 @@ class EbuildFetchTestCase(TestCase): def testEbuildFetch(self): + user_config = { + "make.conf": + ( + 'GENTOO_MIRRORS="{scheme}://{host}:{port}"', + ), + } + distfiles = { 'bar': b'bar\n', 'foo': b'foo\n', @@ -37,7 +44,6 @@ class EbuildFetchTestCase(TestCase): ebuilds = { 'dev-libs/A-1': { 'EAPI': '7', - 'RESTRICT': 'primaryuri', 'SRC_URI': '''{scheme}://{host}:{port}/distfiles/bar.txt -> bar {scheme}://{host}:{port}/distfiles/foo.txt -> foo''', }, @@ -47,7 +53,13 @@ class EbuildFetchTestCase(TestCase): scheme = 'http' host = '127.0.0.1' content = {} + + content['/distfiles/layout.conf'] = b'[structure]\n0=flat\n' + for k, v in distfiles.items(): + # mirror path + content['/distfiles/{}'.format(k)] = v + # upstream path content['/distfiles/{}.txt'.format(k)] = v with AsyncHTTPServer(host, content, loop) as server: @@ -58,7 +70,16 @@ class EbuildFetchTestCase(TestCase): scheme=scheme, host=host, port=server.server_port) ebuilds_subst[cpv] = metadata - playground = ResolverPlayground(ebuilds=ebuilds_subst, distfiles=distfiles) + user_config_subst = user_config.copy() + for configname, configdata in user_config.items(): + + configdata_sub = [] + for line in configdata: + configdata_sub.append(line.format( + scheme=scheme, host=host, port=server.server_port)) + user_config_subst[configname] = tuple(configdata_sub) + + playground = ResolverPlayground(ebuilds=ebuilds_subst, distfiles=distfiles, user_config=user_config_subst) ro_distdir = tempfile.mkdtemp() eubin = os.path.join(playground.eprefix, "usr", "bin") try: |