Ejemplo n.º 1
0
    def test_check_pending_local_changes_unpushed_test(self):
        """Check that a repository with local commits is *not* removed from
        the list of distributions to be released if test is True
        """
        # create repo
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        os.makedirs(path)
        repo_folder = '{0}/my.distribution'.format(path)
        repo = self.buildout_repo.clone(repo_folder)

        # make a commit on the repo
        self._commit(repo)

        # full release
        full_release = FullRelease(path=path, test=True)
        full_release.distributions = [repo_folder, ]

        with OutputCapture():
            full_release.check_pending_local_changes()

        # check the distribution is not removed
        self.assertEqual(
            full_release.distributions,
            [repo_folder, ]
        )
Ejemplo n.º 2
0
    def test_check_pending_local_changes_dirty(self):
        """Check that a repository with local changes (uncommitted) is removed
        from the list of distributions to be released
        """
        # create repo
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        os.makedirs(path)
        repo_folder = '{0}/my.distribution'.format(path)
        repo = self.buildout_repo.clone(repo_folder)

        # add a file
        file_path = '{0}/tmp_file'.format(repo_folder)
        with open(file_path, 'w') as afile:
            afile.write('something')
            repo.index.add([file_path, ])

        # full release
        full_release = FullRelease(path=path)
        full_release.distributions = [repo_folder, ]

        utils.test_answer_book.set_answers(['Y', ])
        with OutputCapture():
            full_release.check_pending_local_changes()

        # check the distribution is removed
        self.assertEqual(
            full_release.distributions,
            []
        )
Ejemplo n.º 3
0
    def test_check_pending_local_changes_clean(self):
        """Check that a clean repository is not removed from the list of
        distributions to be released
        """
        # create repo
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        os.makedirs(path)
        repo_folder = '{0}/my.distribution'.format(path)
        self.buildout_repo.clone(repo_folder)

        # full release
        full_release = FullRelease(path=path)
        full_release.distributions = [repo_folder, ]

        utils.test_answer_book.set_answers(['Y', ])
        with OutputCapture():
            full_release.check_pending_local_changes()

        # check the distribution is not removed
        self.assertEqual(
            full_release.distributions,
            [repo_folder, ]
        )