Skip to content

Commit

Permalink
Fix test_upgrade when running outside of docker image
Browse files Browse the repository at this point in the history
E.g. direct on github runner.
  • Loading branch information
erijo committed Dec 10, 2024
1 parent 3093460 commit 24772e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
],
)
@pytest.mark.parametrize("submodule", [False, True], ids=["no submodule", "with submodules"])
def test_upgrade(tmpdir, runner, versions, submodule):
def test_upgrade(tmpdir, runner, paths, versions, submodule):
"""Upgrade tests"""
# pylint: disable=too-many-statements
home = tmpdir.mkdir("HOME")
env = {"HOME": str(home)}
runner(["git", "config", "--global", "init.defaultBranch", "master"], env=env)
runner(["git", "config", "--global", "protocol.file.allow", "always"], env=env)
runner(["git", "config", "--global", "user.email", "[email protected]"], env=env)
runner(["git", "config", "--global", "user.name", "Yadm Test"], env=env)

if submodule:
ext_repo = tmpdir.mkdir("ext_repo")
Expand All @@ -39,7 +41,7 @@ def test_upgrade(tmpdir, runner, versions, submodule):
os.environ.pop("XDG_DATA_HOME", None)

def run_version(version, *args, check_stderr=True):
yadm = f"yadm-{version}" if version else "/yadm/yadm"
yadm = f"yadm-{version}" if version else paths.pgm
run = runner([yadm, *args], shell=True, cwd=str(home), env=env)
assert run.success
if check_stderr:
Expand Down

0 comments on commit 24772e7

Please sign in to comment.