def test_get_all_distributions_folder(self):
        """Check that a folder is not considered a distribution"""
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        # create a folder
        os.makedirs('{0}/folder-not-repo'.format(path))

        full_release = FullRelease(path=path)

        with OutputCapture():
            full_release.get_all_distributions()

        self.assertEqual(
            full_release.distributions,
            []
        )
    def test_get_all_distributions_file(self):
        """Check that a file is not considered a distribution"""
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        # create a file
        os.makedirs(path)
        with open('{0}/random-file'.format(path), 'w') as afile:
            afile.write('something')

        full_release = FullRelease(path=path)

        with OutputCapture():
            full_release.get_all_distributions()

        self.assertEqual(
            full_release.distributions,
            []
        )
    def test_get_all_distributions_repo(self):
        """Check that a git repository is considered a distribution"""
        path = '{0}/src'.format(self.user_buildout_repo.working_tree_dir)
        os.makedirs(path)
        repo_folder = '{0}/my.distribution'.format(path)
        repo1 = self.buildout_repo.clone(repo_folder)
        repo_folder = '{0}/my.distribution2'.format(path)
        repo2 = self.buildout_repo.clone(repo_folder)

        full_release = FullRelease(path=path)

        with OutputCapture():
            full_release.get_all_distributions()

        self.assertEqual(
            full_release.distributions,
            [repo1.working_tree_dir, repo2.working_tree_dir, ]
        )