예제 #1
0
    def setUp(self):
        repo = create_repo('deployable_2_envs')
        default = add_env(repo, 'default', """
            env:
             - python
            channels:
             - defaults 
            """)
        resolve.build_manifest_branches(repo)

        bleeding = add_env(repo, 'bleeding', """
            env:
             - python >2
             - numpy
            channels:
             - defaults 
            """)
        resolve.build_manifest_branches(repo)
        for tag in tag_dates.tag_by_branch(repo):
            label_tag.progress_label(repo, tag.name)

        update_env(repo, default, """
            env:
             - python 2.*
            channels: 
             - defaults 
            """)
        resolve.build_manifest_branches(repo)
        for tag in tag_dates.tag_by_branch(repo):
            self.default_next_tag = tag.name
            label_tag.progress_label(repo, tag.name)

        self.repo = repo
예제 #2
0
    def test(self):
        repo = setup_samples.create_repo('tag_by_date')
        env = repo.create_head('manifest/example_env')

        check_call(['conda', 'gitenv', 'autotag', repo.working_dir])

        self.assertEqual(repo.tags[0].commit, env.commit)
예제 #3
0
    def test(self):
        repo = setup_samples.create_repo('tag_by_date')
        env = repo.create_head('manifest/example_env')
                 
        check_call(['conda', 'gitenv', 'autotag', repo.working_dir])

        self.assertEqual(repo.tags[0].commit, env.commit)
예제 #4
0
    def setUp(self):
        repo = create_repo('deployable_2_envs')
        default = add_env(
            repo, 'default', """
            env:
             - python
            channels:
             - defaults 
            """)
        resolve.build_manifest_branches(repo)

        bleeding = add_env(
            repo, 'bleeding', """
            env:
             - python >2
             - numpy
            channels:
             - defaults 
            """)
        resolve.build_manifest_branches(repo)
        for tag in tag_dates.tag_by_branch(repo):
            label_tag.progress_label(repo, tag.name)

        update_env(
            repo, default, """
            env:
             - python 2.*
            channels: 
             - defaults 
            """)
        resolve.build_manifest_branches(repo)
        for tag in tag_dates.tag_by_branch(repo):
            self.default_next_tag = tag.name
            label_tag.progress_label(repo, tag.name)

        self.repo = repo
 def setUp(self):
     name = 'conda_rpms_{}'.format(self._testMethodName)
     self.repo = setup_samples.create_repo(name)
     self.bname = 'default'
     self.env_spec = """
                     channels:
                         - defaults
                     env:
                         - python
                     """
     # Require to create a dummy manifest branch.
     self.repo.create_head(manifest_branch_prefix + self.bname)
     self.branch = setup_samples.add_env(self.repo, self.bname,
                                         self.env_spec)
     func = 'conda_rpms.build_rpm_structure.create_rpmbuild_for_tag'
     self.mock_create_tag = self.patch(func)
     func = 'conda_rpms.generate.render_env'
     self.mock_render_env = self.patch(func, return_value='dummy-env')
     self.config = dict(rpm=dict(prefix='prefix'))
     self.ctag = 'env-{}-2017_01_01'.format(self.bname)
     self.add_label(self.repo, self.branch, 'current.txt', self.ctag)
     self.ntag = 'env-{}-2017_02_02'.format(self.bname)
     self.add_label(self.repo, self.branch, 'next.txt', self.ntag)
     self.count = self.branch.commit.count()
예제 #6
0
 def setUp(self):
     self.repo = create_repo('env_tags')
예제 #7
0
 def test(self):
     repo = setup_samples.create_repo('tag_by_date')
     env = repo.create_head('manifest/example_env')
     new_tags = list(tag_by_branch(repo))
     self.assertEqual(len(new_tags), 1)
     self.assertEqual(new_tags[0].commit, env.commit)
예제 #8
0
 def test(self):
     repo = setup_samples.create_repo('tag_by_date')
     env = repo.create_head('manifest/example_env')
     new_tags = list(tag_by_branch(repo))
     self.assertEqual(len(new_tags), 1)
     self.assertEqual(new_tags[0].commit, env.commit)
예제 #9
0
    def test(self):
        repo = setup_samples.create_repo('labelled_tags')

        tag1 = 'env-example_env-1971_02_28'
        tag2 = 'env-example_env-1972_03_31'
        tag3 = 'env-example_env-1973_05_31'
        tag4 = 'env-example_env-1974_05_31'

        branch = repo.create_head('example_env')
        manifest_branch = repo.create_head('manifest/example_env')
        repo.create_tag(tag1, manifest_branch)

        labels_dir = os.path.join(repo.working_dir, 'labels')
        next_fname = os.path.join(labels_dir, 'next.txt')
        prev_fname = os.path.join(labels_dir, 'previous.txt')
        current_fname = os.path.join(labels_dir, 'current.txt')

        branch.checkout()
        self.assertFalse(os.path.exists(labels_dir))
        # Checkout a different branch so that we can checkout the changes later on.
        manifest_branch.checkout()
        check_call(['conda', 'gitenv', 'autolabel', repo.working_dir, tag1])

        branch.checkout()
        self.assertTrue(os.path.exists(labels_dir))

        with open(next_fname, 'r') as fh:
            next_label = fh.read()
        self.assertEqual(next_label, tag1)
        self.assertFalse(os.path.exists(prev_fname))
        self.assertFalse(os.path.exists(current_fname))

        # Now add another tag, and move it through the process.
        repo.create_tag(tag2, manifest_branch)
        manifest_branch.checkout()
        check_call(['conda', 'gitenv', 'autolabel', repo.working_dir, tag2])

        branch.checkout()
        with open(next_fname, 'r') as fh:
            next_label = fh.read()
        self.assertEqual(next_label, tag2)
        with open(current_fname, 'r') as fh:
            current_label = fh.read()
        self.assertEqual(current_label, tag1)
        self.assertFalse(os.path.exists(prev_fname))

        # Now add another tag, but only update the "next" label..
        repo.create_tag(tag3, manifest_branch)
        manifest_branch.checkout()
        check_call(['conda', 'gitenv', 'autolabel', repo.working_dir, tag3, '--next-only'])

        branch.checkout()
        with open(next_fname, 'r') as fh:
            next_label = fh.read()
        self.assertEqual(next_label, tag3)
        with open(current_fname, 'r') as fh:
            current_label = fh.read()
        self.assertEqual(current_label, tag1)
        self.assertFalse(os.path.exists(prev_fname))

        # Now add another tag, and move it through the process.
        repo.create_tag(tag4, manifest_branch)
        manifest_branch.checkout()
        check_call(['conda', 'gitenv', 'autolabel', repo.working_dir, tag4])

        branch.checkout()
        with open(next_fname, 'r') as fh:
            next_label = fh.read()
        self.assertEqual(next_label, tag4)
        with open(current_fname, 'r') as fh:
            current_label = fh.read()
        self.assertEqual(current_label, tag3)
        with open(prev_fname, 'r') as fh:
            prev_label = fh.read()
        self.assertEqual(prev_label, tag1)
예제 #10
0
 def setUp(self):
     self.repo = create_repo("env_tags")