Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow local and external deps to be specified #469

Merged
merged 1 commit into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions synthtool/gcp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def py_library(self, **kwargs) -> Path:
# kwargs["metadata"] is required to load values from .repo-metadata.json
if "metadata" not in kwargs:
kwargs["metadata"] = {}
# rename variable to accomodate existing synth.py files
if "system_test_dependencies" in kwargs:
kwargs["system_test_local_dependencies"] = kwargs[
"system_test_dependencies"
]
log.warning(
"Template argument 'system_test_dependencies' is deprecated."
"Use 'system_test_local_dependencies' or 'system_test_external_dependencies'"
"instead."
)

return self._generic_library("python_library", **kwargs)

Expand Down
9 changes: 6 additions & 3 deletions synthtool/gcp/templates/python_library/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ def system(session):

# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
session.install("mock", "pytest")
{% for dependency in system_test_dependencies %}
session.install("-e", "{{dependency}}"){% endfor %}
session.install("mock", "pytest", {% for d in system_test_external_dependencies %}"{{d}}"{% if not loop.last %},{% endif %}{% endfor %})

{%- if system_test_local_dependencies %}
session.install("-e", {% for d in system_test_local_dependencies %}"{{d}}"{% if not loop.last %},{% endif %}{% endfor %})
{%- endif %}
session.install("-e", ".")


# Run py.test against the system tests.
if system_test_exists:
session.run("py.test", "--quiet", system_test_path, *session.posargs)
Expand Down