Skip to content

Commit

Permalink
fix(python_library): fix unit test dependency installation (#811)
Browse files Browse the repository at this point in the history
Perviously, system tests allow users to pass in separate lists for `system_test_external_dependencies` and `unit_test_local_dependencies`, which would install dependencies needed for the test. Unit tests only had a single option called `unit_test_dependencies`, which only supported local packages.

This PR makes unit tests consistent with system tests by handling `unit_test_external_dependencies` and `unit_test_local_dependencies`. I kept  `unit_test_dependencies` around with it's previous behaviour for backwards compatibility, in case any repos are using it as-is.
  • Loading branch information
daniel-sanche authored Oct 26, 2020
1 parent f68649c commit fd3584b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions synthtool/gcp/templates/python_library/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ def default(session):
{%- if microgenerator %}
session.install("asyncmock", "pytest-asyncio")
{% endif %}
session.install("mock", "pytest", "pytest-cov")
session.install("-e", "."){% for dependency in unit_test_dependencies %}
session.install("-e", "{{dependency}}"){% endfor %}
session.install("mock", "pytest", "pytest-cov" {% for d in unit_test_external_dependencies %}"{{d}}"{% if not loop.last %},{% endif %}{% endfor %})
session.install("-e", ".")
{% for dependency in unit_test_local_dependencies %}session.install("-e", "{{dependency}}"){% endfor %}
{% for dependency in unit_test_dependencies %}session.install("-e", "{{dependency}}"){% endfor %}

# Run py.test against the unit tests.
session.run(
Expand Down

0 comments on commit fd3584b

Please sign in to comment.