Skip to content

Commit db4f15f

Browse files
authored
feat(python): add defaults for microgenerator libraries (#642)
1 parent 4f2c9f7 commit db4f15f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

synthtool/gcp/common.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,20 @@ def py_library(self, **kwargs) -> Path:
7676

7777
# Set default Python versions for noxfile.py
7878
if "default_python_version" not in kwargs:
79-
kwargs["default_python_version"] = "3.7"
79+
kwargs["default_python_version"] = "3.8"
8080
if "unit_test_python_versions" not in kwargs:
81-
kwargs["unit_test_python_versions"] = ["2.7", "3.5", "3.6", "3.7", "3.8"]
81+
kwargs["unit_test_python_versions"] = ["3.6", "3.7", "3.8"]
82+
if "microgenerator" not in kwargs:
83+
kwargs["unit_test_python_versions"] = ["2.7", "3.5"] + kwargs[
84+
"unit_test_python_versions"
85+
]
86+
8287
if "system_test_python_versions" not in kwargs:
83-
kwargs["system_test_python_versions"] = ["2.7", "3.7"]
88+
kwargs["system_test_python_versions"] = ["3.8"]
89+
if "microgenerator" not in kwargs:
90+
kwargs["system_test_python_versions"] = ["2.7"] + kwargs[
91+
"system_test_python_versions"
92+
]
8493

8594
# Don't add samples templates if there are no samples
8695
if "samples" not in kwargs:

synthtool/gcp/templates/python_library/noxfile.py.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def lint_setup_py(session):
7272

7373
def default(session):
7474
# Install all test dependencies, then install this package in-place.
75+
76+
{%- if microgenerator %}
77+
session.install("asyncmock", "pytest-asyncio")
78+
{% endif -%}
7579
session.install("mock", "pytest", "pytest-cov")
7680
session.install("-e", "."){% for dependency in unit_test_dependencies %}
7781
session.install("-e", "{{dependency}}"){% endfor %}

0 commit comments

Comments
 (0)