def install_pip(self, package, save=True, save_dev=False):
        """Installs a pip package.

        :param save: if `True`, pins the package to the Hydrogen requirements
            YAML file.
        :param save_dev: if `True`, pins the package as a development
            dependency to the Hydrogen requirements YAML file.
        :param return: a **single** :class:`Requirement` object, representing
            the installed version of the given package.
        """
        requirement = Requirement.coerce(package)
        click.echo("pip install " + requirement.package)
        cmd = envoy.run("pip install {}".format(str(requirement)))
        if cmd.status_code == 0:
            installed_packages = get_installed_pypackages()
            package = installed_packages[requirement.package]
            requirement.version = "=={}".format(package.version)
            if save:
                self.requirements["all"].add(requirement)
            if save_dev:
                self.requirements["dev"].add(requirement)
            if save or save_dev:
                self.requirements.save()
            return requirement
        else:
            fatal(cmd.std_err)
def test_validate_author_id_format(self):
        expected_suggestion_dict = self.suggestion_dict
        suggestion = suggestion_registry.SuggestionAddQuestion(
            expected_suggestion_dict['suggestion_id'],
            expected_suggestion_dict['target_id'],
            expected_suggestion_dict['target_version_at_submission'],
            expected_suggestion_dict['status'], self.author_id,
            self.reviewer_id, expected_suggestion_dict['change'],
            expected_suggestion_dict['score_category'],
            expected_suggestion_dict['language_code'], False, self.fake_date)

        suggestion.validate()

        suggestion.author_id = ''
        with self.assertRaisesRegex(
            utils.ValidationError,
            'Expected author_id to be in a valid user ID format.'):
            suggestion.validate()