Skip to content

Commit 04a742e

Browse files
chore(python): add license header to auto-label.yaml (googleapis#709)
Source-Link: googleapis/synthtool@eb78c98 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 474b1b5 commit 04a742e

File tree

5 files changed

+104
-23
lines changed

5 files changed

+104
-23
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Generated by synthtool. DO NOT EDIT!
1818
[flake8]
19-
ignore = E203, E266, E501, W503
19+
ignore = E203, E231, E266, E501, W503
2020
exclude =
2121
# Exclude generated code.
2222
**/proto/**

.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
16+
digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163
17+
# created: 2022-04-06T10:30:21.687684602Z

.github/auto-label.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
requestsize:
15+
enabled: true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: end-of-file-fixer
2323
- id: check-yaml
2424
- repo: https://github.com/psf/black
25-
rev: 19.10b0
25+
rev: 22.3.0
2626
hooks:
2727
- id: black
2828
- repo: https://gitlab.com/pycqa/flake8

noxfile.py

Lines changed: 85 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,40 @@
2020
import os
2121
import pathlib
2222
import shutil
23+
import warnings
2324

2425
import nox
2526

26-
2727
BLACK_VERSION = "black==22.3.0"
2828
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
2929

3030
DEFAULT_PYTHON_VERSION = "3.8"
31-
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
31+
3232
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
33+
UNIT_TEST_STANDARD_DEPENDENCIES = [
34+
"mock",
35+
"asyncmock",
36+
"pytest",
37+
"pytest-cov",
38+
"pytest-asyncio",
39+
]
40+
UNIT_TEST_EXTERNAL_DEPENDENCIES = []
41+
UNIT_TEST_LOCAL_DEPENDENCIES = []
42+
UNIT_TEST_DEPENDENCIES = []
43+
UNIT_TEST_EXTRAS = []
44+
UNIT_TEST_EXTRAS_BY_PYTHON = {}
45+
46+
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
47+
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
48+
"mock",
49+
"pytest",
50+
"google-cloud-testutils",
51+
]
52+
SYSTEM_TEST_EXTERNAL_DEPENDENCIES = []
53+
SYSTEM_TEST_LOCAL_DEPENDENCIES = []
54+
SYSTEM_TEST_DEPENDENCIES = []
55+
SYSTEM_TEST_EXTRAS = []
56+
SYSTEM_TEST_EXTRAS_BY_PYTHON = {}
3357

3458
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
3559

@@ -81,23 +105,41 @@ def lint_setup_py(session):
81105
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
82106

83107

108+
def install_unittest_dependencies(session, *constraints):
109+
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
110+
session.install(*standard_deps, *constraints)
111+
112+
if UNIT_TEST_EXTERNAL_DEPENDENCIES:
113+
warnings.warn(
114+
"'unit_test_external_dependencies' is deprecated. Instead, please "
115+
"use 'unit_test_dependencies' or 'unit_test_local_dependencies'.",
116+
DeprecationWarning,
117+
)
118+
session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints)
119+
120+
if UNIT_TEST_LOCAL_DEPENDENCIES:
121+
session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints)
122+
123+
if UNIT_TEST_EXTRAS_BY_PYTHON:
124+
extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
125+
elif UNIT_TEST_EXTRAS:
126+
extras = UNIT_TEST_EXTRAS
127+
else:
128+
extras = []
129+
130+
if extras:
131+
session.install("-e", f".[{','.join(extras)}]", *constraints)
132+
else:
133+
session.install("-e", ".", *constraints)
134+
135+
84136
def default(session):
85137
# Install all test dependencies, then install this package in-place.
86138

87139
constraints_path = str(
88140
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
89141
)
90-
session.install(
91-
"mock",
92-
"asyncmock",
93-
"pytest",
94-
"pytest-cov",
95-
"pytest-asyncio",
96-
"-c",
97-
constraints_path,
98-
)
99-
100-
session.install("-e", ".", "-c", constraints_path)
142+
install_unittest_dependencies(session, "-c", constraints_path)
101143

102144
# Run py.test against the unit tests.
103145
session.run(
@@ -142,6 +184,35 @@ def unit(session):
142184
default(session)
143185

144186

187+
def install_systemtest_dependencies(session, *constraints):
188+
189+
# Use pre-release gRPC for system tests.
190+
session.install("--pre", "grpcio")
191+
192+
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)
193+
194+
if SYSTEM_TEST_EXTERNAL_DEPENDENCIES:
195+
session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints)
196+
197+
if SYSTEM_TEST_LOCAL_DEPENDENCIES:
198+
session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints)
199+
200+
if SYSTEM_TEST_DEPENDENCIES:
201+
session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints)
202+
203+
if SYSTEM_TEST_EXTRAS_BY_PYTHON:
204+
extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
205+
elif SYSTEM_TEST_EXTRAS:
206+
extras = SYSTEM_TEST_EXTRAS
207+
else:
208+
extras = []
209+
210+
if extras:
211+
session.install("-e", f".[{','.join(extras)}]", *constraints)
212+
else:
213+
session.install("-e", ".", *constraints)
214+
215+
145216
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
146217
def system(session):
147218
"""Run the system test suite."""
@@ -172,13 +243,7 @@ def system(session):
172243
if not system_test_exists and not system_test_folder_exists:
173244
session.skip("System tests were not found")
174245

175-
# Use pre-release gRPC for system tests.
176-
session.install("--pre", "grpcio")
177-
178-
# Install all test dependencies, then install this package into the
179-
# virtualenv's dist-packages.
180-
session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path)
181-
session.install("-e", ".[tracing]", "-c", constraints_path)
246+
install_systemtest_dependencies(session, "-c", constraints_path)
182247

183248
# Run py.test against the system tests.
184249
if system_test_exists:

0 commit comments

Comments
 (0)