Skip to content

Commit 963e61e

Browse files
committed
tests: run tests in parallel
1 parent 6d04c1f commit 963e61e

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2025 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+
description: Run tests in parallel to debug generation issue
15+
url: https://github.com/googleapis/google-cloud-python/issues/14992
16+
replacements:
17+
- paths: [
18+
packages/google-cloud-compute/noxfile.py,
19+
]
20+
before: |
21+
"pytest-asyncio",
22+
\]
23+
after: |
24+
"pytest-asyncio",
25+
"pytest-xdist",
26+
]
27+
count: 1
28+
- paths: [
29+
packages/google-cloud-compute/noxfile.py,
30+
]
31+
before: |
32+
session.install\("protobuf<4"\)
33+
\
34+
\ # Run py.test against the unit tests.
35+
after: |
36+
session.install("protobuf<4")\n
37+
concurrent_args = ["-n", "auto"]\n
38+
# Run py.test against the unit tests.
39+
count: 1
40+
- paths: [
41+
packages/google-cloud-compute/noxfile.py,
42+
]
43+
before: |
44+
\*session.posargs,
45+
\ env=\{
46+
after: |
47+
*session.posargs,
48+
*concurrent_args,
49+
env={
50+
count: 1
51+

packages/google-cloud-compute/noxfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"pytest",
6161
"pytest-cov",
6262
"pytest-asyncio",
63+
"pytest-xdist",
6364
]
6465
UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = []
6566
UNIT_TEST_LOCAL_DEPENDENCIES: List[str] = []
@@ -253,6 +254,8 @@ def unit(session, protobuf_implementation):
253254
if protobuf_implementation == "cpp":
254255
session.install("protobuf<4")
255256

257+
concurrent_args = ["-n", "auto"]
258+
256259
# Run py.test against the unit tests.
257260
session.run(
258261
"py.test",
@@ -266,6 +269,7 @@ def unit(session, protobuf_implementation):
266269
"--cov-fail-under=0",
267270
os.path.join("tests", "unit"),
268271
*session.posargs,
272+
*concurrent_args,
269273
env={
270274
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
271275
},

0 commit comments

Comments
 (0)