From 99b1e7548a441af77d0eca71367c7ad83bd69e23 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 13 Dec 2018 12:43:45 -0600 Subject: [PATCH] Update test_labels.py --- repo2docker/app.py | 2 ++ tests/test_labels.py | 26 +++++++++----------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/repo2docker/app.py b/repo2docker/app.py index 7b5d3744..97abc3cf 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -744,6 +744,8 @@ class Repo2Docker(Application): else: picked_buildpack = self.default_buildpack() + self._picked_buildpack = picked_buildpack + picked_buildpack.appendix = self.appendix picked_buildpack.labels['repo2docker.version'] = self.version picked_buildpack.labels['repo2docker.repo'] = self.repo diff --git a/tests/test_labels.py b/tests/test_labels.py index 1e90cf16..5c6a1424 100644 --- a/tests/test_labels.py +++ b/tests/test_labels.py @@ -10,28 +10,20 @@ import pytest @pytest.mark.parametrize('ref', ['some-branch', None]) def test_labels(ref, tmpdir): app = Repo2Docker() + repo = str(tmpdir) if ref is not None: - argv = ['--ref', ref, str(tmpdir)] + argv = ['--ref', ref, repo] else: - argv = [str(tmpdir)] + argv = [repo] app.initialize(argv) - app.debug = True + app.build = False app.run = False - app.start() # This just build the image and does not run it. - container = app.start_container() + app.start() + labels = app._picked_buildpack.labels expected_labels = { - 'repo2docker.ref': str(ref), - 'repo2docker.repo': str(tmpdir), + 'repo2docker.ref': ref, + 'repo2docker.repo': repo, 'repo2docker.version': __version__, } - # wait a bit for the container to be ready - # give the container a chance to start - time.sleep(1) - - try: - assert container.labels == expected_labels - finally: - # stop the container - container.stop() - app.wait_for_container(container) + assert labels == expected_labels