From 7747d1f6a3896bcef133b4421f930b68ff22d6ad Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 15 Oct 2020 17:21:14 -0700 Subject: [PATCH 1/4] allow unit test dependencies --- synthtool/gcp/templates/python_library/noxfile.py.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/python_library/noxfile.py.j2 b/synthtool/gcp/templates/python_library/noxfile.py.j2 index 5c9ac730c..64615b2f1 100644 --- a/synthtool/gcp/templates/python_library/noxfile.py.j2 +++ b/synthtool/gcp/templates/python_library/noxfile.py.j2 @@ -78,7 +78,7 @@ def default(session): {% endif %} session.install("mock", "pytest", "pytest-cov") session.install("-e", "."){% for dependency in unit_test_dependencies %} - session.install("-e", "{{dependency}}"){% endfor %} + session.install("{{dependency}}"){% endfor %} # Run py.test against the unit tests. session.run( From f7183b27f5c6d6845d12a68ffeaf3ce499698731 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 15 Oct 2020 17:29:06 -0700 Subject: [PATCH 2/4] better formatted --- synthtool/gcp/templates/python_library/noxfile.py.j2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/python_library/noxfile.py.j2 b/synthtool/gcp/templates/python_library/noxfile.py.j2 index 64615b2f1..3fedf2a03 100644 --- a/synthtool/gcp/templates/python_library/noxfile.py.j2 +++ b/synthtool/gcp/templates/python_library/noxfile.py.j2 @@ -77,8 +77,10 @@ def default(session): session.install("asyncmock", "pytest-asyncio") {% endif %} session.install("mock", "pytest", "pytest-cov") - session.install("-e", "."){% for dependency in unit_test_dependencies %} - session.install("{{dependency}}"){% endfor %} + session.install("-e", ".") + {% for dependency in unit_test_dependencies %} + session.install("{{dependency}}") + {% endfor %} # Run py.test against the unit tests. session.run( From 1546f5a3cef417959666b64274e4e714c38c4708 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 15 Oct 2020 17:58:55 -0700 Subject: [PATCH 3/4] added internal and external dependencies --- synthtool/gcp/templates/python_library/noxfile.py.j2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/python_library/noxfile.py.j2 b/synthtool/gcp/templates/python_library/noxfile.py.j2 index 3fedf2a03..15ed9a25b 100644 --- a/synthtool/gcp/templates/python_library/noxfile.py.j2 +++ b/synthtool/gcp/templates/python_library/noxfile.py.j2 @@ -76,10 +76,13 @@ def default(session): {%- if microgenerator %} session.install("asyncmock", "pytest-asyncio") {% endif %} - session.install("mock", "pytest", "pytest-cov") + 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("{{dependency}}") + session.install("-e", "{{dependency}}") {% endfor %} # Run py.test against the unit tests. From 37434fbb8f4c43653e98dd984111cfac1e7b536d Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 15 Oct 2020 18:04:26 -0700 Subject: [PATCH 4/4] restructured code --- synthtool/gcp/templates/python_library/noxfile.py.j2 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/synthtool/gcp/templates/python_library/noxfile.py.j2 b/synthtool/gcp/templates/python_library/noxfile.py.j2 index 15ed9a25b..2d060529f 100644 --- a/synthtool/gcp/templates/python_library/noxfile.py.j2 +++ b/synthtool/gcp/templates/python_library/noxfile.py.j2 @@ -78,12 +78,8 @@ def default(session): {% endif %} 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 %} + {% 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(