kopia lustrzana https://github.com/jupyterhub/repo2docker
Fix unit tests
rodzic
5c2c8f7385
commit
4ed6685dc9
|
@ -14,7 +14,7 @@ from repo2docker.utils import chdir
|
|||
def test_find_image():
|
||||
images = [{"RepoTags": ["some-org/some-repo:latest"]}]
|
||||
|
||||
with patch("repo2docker.app.docker.APIClient") as FakeDockerClient:
|
||||
with patch("repo2docker.docker.docker.APIClient") as FakeDockerClient:
|
||||
instance = FakeDockerClient.return_value
|
||||
instance.images.return_value = images
|
||||
|
||||
|
@ -28,7 +28,7 @@ def test_find_image():
|
|||
def test_dont_find_image():
|
||||
images = [{"RepoTags": ["some-org/some-image-name:latest"]}]
|
||||
|
||||
with patch("repo2docker.app.docker.APIClient") as FakeDockerClient:
|
||||
with patch("repo2docker.docker.docker.APIClient") as FakeDockerClient:
|
||||
instance = FakeDockerClient.return_value
|
||||
instance.images.return_value = images
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@ def test_editable_by_host():
|
|||
|
||||
try:
|
||||
with tempfile.NamedTemporaryFile(dir=DIR, prefix="testfile", suffix=".txt"):
|
||||
status, output = container.exec_run(["sh", "-c", "ls testfile????????.txt"])
|
||||
status, output = container._c.exec_run(
|
||||
["sh", "-c", "ls testfile????????.txt"]
|
||||
)
|
||||
assert status == 0
|
||||
assert re.match(br"^testfile\w{8}\.txt\n$", output) is not None
|
||||
# After exiting the with block the file should stop existing
|
||||
# in the container as well as locally
|
||||
status, output = container.exec_run(["sh", "-c", "ls testfile????????.txt"])
|
||||
status, output = container._c.exec_run(["sh", "-c", "ls testfile????????.txt"])
|
||||
assert status == 2
|
||||
assert re.match(br"^testfile\w{8}\.txt\n$", output) is None
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ def test_Repo2Docker_external_build_scripts(tmpdir):
|
|||
assert container.status == "running"
|
||||
|
||||
try:
|
||||
status, output = container.exec_run(["sh", "-c", "cat /tmp/my_extra_script"])
|
||||
status, output = container._c.exec_run(["sh", "-c", "cat /tmp/my_extra_script"])
|
||||
assert status == 0
|
||||
assert output.decode("utf-8") == "Hello World of Absolute Paths!"
|
||||
finally:
|
||||
|
|
Ładowanie…
Reference in New Issue