forked from Mirror/pmbootstrap
test: conftest: adjust pmaports fixture (MR 2477) (MR 2483)
make sure that calls to get_upstream_remote() will succeed by setting pmb.config.git_repos() for the entire run. This might pollute some other tests... TODO: make less things depend on pmaports being cloned... Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
1131db214a
commit
39a696ceed
1 changed files with 11 additions and 7 deletions
|
@ -159,16 +159,20 @@ def pmaports(pmb_args, monkeypatch):
|
||||||
from pmb.core import Config
|
from pmb.core import Config
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
|
|
||||||
config = get_context().config
|
cfg = get_context().config
|
||||||
|
|
||||||
with monkeypatch.context() as m:
|
# As an optimisation, we check the default workdir for pmaports
|
||||||
# Speed things up by cloning from the local checkout if it exists.
|
# and clone it from there if it exists. This saves a bunch of bandwidth
|
||||||
if Config.aports[0].exists():
|
# and time.
|
||||||
m.setitem(pmb.config.git_repos, "pmaports", Config.aports)
|
if Config.aports[-1].exists():
|
||||||
|
# Override the URL to the local path so we can later look up the
|
||||||
|
# remote by URL
|
||||||
|
pmb.config.git_repos["pmaports"] = [str(Config.aports[-1])]
|
||||||
|
|
||||||
|
if not cfg.aports[-1].exists():
|
||||||
pmb.helpers.git.clone("pmaports")
|
pmb.helpers.git.clone("pmaports")
|
||||||
|
# Now operate on the cloned repo
|
||||||
assert pmb.helpers.run.user(["git", "checkout", "master"], working_dir=config.aports[0]) == 0
|
assert pmb.helpers.run.user(["git", "checkout", "master"], working_dir=cfg.aports[-1]) == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue