repo2docker/tests/unit/test_binder_dir.py

27 wiersze
595 B
Python
Czysty Zwykły widok Historia

2019-04-30 15:35:58 +00:00
import os
import pytest
from repo2docker import buildpacks
@pytest.mark.parametrize("binder_dir", ["binder", ".binder", ""])
def test_binder_dir(tmpdir, binder_dir):
2019-04-30 15:35:58 +00:00
tmpdir.chdir()
if binder_dir:
os.mkdir(binder_dir)
2019-04-30 15:35:58 +00:00
bp = buildpacks.BuildPack()
assert binder_dir == bp.binder_dir
assert bp.binder_path("foo.yaml") == os.path.join(binder_dir, "foo.yaml")
2019-04-30 15:35:58 +00:00
def test_exclusive_binder_dir(tmpdir):
tmpdir.chdir()
os.mkdir("./binder")
os.mkdir("./.binder")
2019-04-30 15:35:58 +00:00
bp = buildpacks.BuildPack()
with pytest.raises(RuntimeError):
_ = bp.binder_dir