Skip to content

Add constraints files for ads templates #16371

@parthea

Description

@parthea

The ads templates are missing the the testing folder which includes constraints files.
As an example, see
https://github.com/googleapis/gapic-generator-python/blob/46f17900204ba10035917b3d744f52556d6061ea/gapic/templates/testing/constraints-3.7.txt.j2#L1-L18

These constraints files are used to run tests against the minimum version of dependencies which are defined in setup.py:
https://github.com/googleapis/gapic-generator-python/blob/46f17900204ba10035917b3d744f52556d6061ea/gapic/ads-templates/setup.py.j2#L19-L33

We also need to change the code in noxfile.py from:
https://github.com/googleapis/gapic-generator-python/blob/812abceeb68d86f3902974aaeef8a58cfd6e7515/noxfile.py#L112-L125

to

            # Use the constraints file for the specific python runtime version.
            # We do this to make sure that we're testing against the lowest
            # supported version of a dependency.
            # This is needed to recreate the issue reported in
            # https://github.com/googleapis/gapic-generator-python/issues/1748
            # The ads templates do not have constraints files.
            constraints_path = str(
            f"{tmp_dir}/testing/constraints-{self.session.python}.txt"
            )
            # Install the generated fragment library.
            if self.use_ads_templates:
                self.session.install(tmp_dir, "-e", ".", "-qqq", "-r", constraints_path)
            else:
                self.session.install(tmp_dir, "-e", ".", "-qqq", "-r", constraints_path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions