Пример #1
0
    def validate(self):
        """Run deployment validation process.

        Upon failure it will exit with return code 200
        to signal shell installation process about validation error.

        .. seealso:: :func:`Deployment.validate`
        """
        from pypeapp.deployment import Deployment, DeployException
        d = Deployment(os.environ.get('PYPE_SETUP_PATH', None))
        try:
            d.validate()
        except DeployException:
            sys.exit(200)
Пример #2
0
    def test_validate_deployment(self, tmp_path, deploy_file):
        d = Deployment(os.path.normpath(tmp_path.as_posix()))
        deploy_test_path = tmp_path / "deploy"
        deploy_test_path.mkdir()
        root_path = os.path.abspath('.')

        # copy deploy and schema to temp test dir
        copyfile(
            os.path.join(root_path, d._deploy_dir, d._schema_file),
            os.path.join(os.path.normpath(deploy_test_path.as_posix()),
                         d._schema_file))

        copyfile(
            os.path.join(root_path, d._deploy_dir, d._deploy_file),
            os.path.join(os.path.normpath(deploy_test_path.as_posix()),
                         d._deploy_file))

        repo_test_path = tmp_path / "repos"
        repo_test_path.mkdir()

        # should fail as `repos` is empty
        with pytest.raises(DeployException) as excinfo:
            d.validate()
        assert excinfo.match(r"Repo path doesn't exist")