From db4f15fedc76e04018e6e43ec403e804e1142158 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Mon, 22 Jun 2020 17:56:27 -0700 Subject: [PATCH] feat(python): add defaults for microgenerator libraries (#642) --- synthtool/gcp/common.py | 15 ++++++++++++--- .../gcp/templates/python_library/noxfile.py.j2 | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index c21fbc493..9181e375e 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -76,11 +76,20 @@ def py_library(self, **kwargs) -> Path: # Set default Python versions for noxfile.py if "default_python_version" not in kwargs: - kwargs["default_python_version"] = "3.7" + kwargs["default_python_version"] = "3.8" if "unit_test_python_versions" not in kwargs: - kwargs["unit_test_python_versions"] = ["2.7", "3.5", "3.6", "3.7", "3.8"] + kwargs["unit_test_python_versions"] = ["3.6", "3.7", "3.8"] + if "microgenerator" not in kwargs: + kwargs["unit_test_python_versions"] = ["2.7", "3.5"] + kwargs[ + "unit_test_python_versions" + ] + if "system_test_python_versions" not in kwargs: - kwargs["system_test_python_versions"] = ["2.7", "3.7"] + kwargs["system_test_python_versions"] = ["3.8"] + if "microgenerator" not in kwargs: + kwargs["system_test_python_versions"] = ["2.7"] + kwargs[ + "system_test_python_versions" + ] # Don't add samples templates if there are no samples if "samples" not in kwargs: diff --git a/synthtool/gcp/templates/python_library/noxfile.py.j2 b/synthtool/gcp/templates/python_library/noxfile.py.j2 index 46657f29b..852bc7547 100644 --- a/synthtool/gcp/templates/python_library/noxfile.py.j2 +++ b/synthtool/gcp/templates/python_library/noxfile.py.j2 @@ -72,6 +72,10 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. + + {%- 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 %}