Skip to content

Commit

Permalink
chore(python_mono_repo): add support for grafeas (#1888)
Browse files Browse the repository at this point in the history
* chore(python_mono_repo): add support for grafeas

* lint
  • Loading branch information
parthea authored Oct 30, 2023
1 parent 2472390 commit 14b6f98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions synthtool/gcp/templates/python_mono_repo_library/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import nox

BLACK_VERSION = "black[jupyter]==23.7.0"
ISORT_VERSION = "isort==5.11.0"
{% if metadata['repo']['distribution_name'].startswith('google') %}
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
{% else %}
LINT_PATHS = ["docs", "{{ metadata['repo']['distribution_name'] }}", "tests", "noxfile.py", "setup.py"]
{% endif %}

DEFAULT_PYTHON_VERSION = "{{ default_python_version }}"

Expand Down Expand Up @@ -156,7 +160,11 @@ def lint(session):
"--check",
*LINT_PATHS,
)
{% if metadata['repo']['distribution_name'].startswith('google') %}
session.run("flake8", "google", "tests")
{% else %}
session.run("flake8", "{{ metadata['repo']['distribution_name'] }}", "tests")
{% endif %}


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down Expand Up @@ -237,7 +245,11 @@ def default(session):
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
{% if metadata['repo']['distribution_name'].startswith('google') %}
"--cov=google",
{% else %}
"--cov={{ metadata['repo']['distribution_name'] }}",
{% endif %}
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
Expand Down
4 changes: 3 additions & 1 deletion synthtool/languages/python_mono_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def owlbot_main(package_dir: str) -> None:
system_test_python_versions=["3.8", "3.9", "3.10", "3.11"],
cov_level=100,
versions=gcp.common.detect_versions(
path=f"{package_dir}/google",
path=f"{package_dir}/google"
if package_name.startswith("google")
else f"{package_dir}/{package_name}",
default_version=default_version,
default_first=True,
),
Expand Down

0 comments on commit 14b6f98

Please sign in to comment.