|
14 | 14 | # See the License for the specific language governing permissions and |
15 | 15 | # limitations under the License. |
16 | 16 |
|
17 | | -# Generated by synthtool. DO NOT EDIT! |
18 | | - |
19 | 17 | from __future__ import absolute_import |
20 | 18 | import os |
21 | 19 | import pathlib |
| 20 | +import re |
22 | 21 | import shutil |
23 | 22 |
|
24 | 23 | import nox |
|
29 | 28 |
|
30 | 29 | DEFAULT_PYTHON_VERSION = "3.8" |
31 | 30 | SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] |
32 | | -UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] |
| 31 | +UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] |
33 | 32 | CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.8"] |
34 | 33 |
|
35 | | -_DEFAULT_STORAGE_HOST = "https://storage.googleapis.com" |
36 | | - |
37 | 34 | CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() |
38 | 35 |
|
39 | 36 | # Error if a python version is missing |
40 | 37 | nox.options.error_on_missing_interpreters = True |
41 | 38 |
|
| 39 | +nox.options.sessions = [ |
| 40 | + "blacken", |
| 41 | + "conftest_retry", |
| 42 | + "docfx", |
| 43 | + "docs", |
| 44 | + "lint", |
| 45 | + "lint_setup_py", |
| 46 | + "system", |
| 47 | + "unit", |
| 48 | + # cover must be last to avoid error `No data to report` |
| 49 | + "cover", |
| 50 | +] |
| 51 | + |
42 | 52 |
|
43 | 53 | @nox.session(python=DEFAULT_PYTHON_VERSION) |
44 | 54 | def lint(session): |
@@ -159,8 +169,8 @@ def system(session): |
159 | 169 | session.install( |
160 | 170 | "google-cloud-testutils", |
161 | 171 | "google-cloud-iam", |
162 | | - "google-cloud-pubsub < 2.0.0", |
163 | | - "google-cloud-kms < 2.0dev", |
| 172 | + "google-cloud-pubsub", |
| 173 | + "google-cloud-kms", |
164 | 174 | "brotli", |
165 | 175 | "-c", |
166 | 176 | constraints_path, |
@@ -300,3 +310,81 @@ def docfx(session): |
300 | 310 | os.path.join("docs", ""), |
301 | 311 | os.path.join("docs", "_build", "html", ""), |
302 | 312 | ) |
| 313 | + |
| 314 | + |
| 315 | +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) |
| 316 | +@nox.parametrize( |
| 317 | + "protobuf_implementation", |
| 318 | + ["python", "upb"], |
| 319 | +) |
| 320 | +def prerelease_deps(session, protobuf_implementation): |
| 321 | + """Run all tests with prerelease versions of dependencies installed.""" |
| 322 | + |
| 323 | + # Install all test dependencies |
| 324 | + session.install("mock", "pytest", "pytest-cov", "brotli") |
| 325 | + |
| 326 | + # Install dependencies needed for system tests |
| 327 | + session.install( |
| 328 | + "google-cloud-pubsub", |
| 329 | + "google-cloud-kms", |
| 330 | + "google-cloud-testutils", |
| 331 | + "google-cloud-iam", |
| 332 | + ) |
| 333 | + |
| 334 | + # Install all dependencies |
| 335 | + session.install("-e", ".[protobuf, tracing]") |
| 336 | + |
| 337 | + prerel_deps = [ |
| 338 | + "google-api-core", |
| 339 | + "google-auth", |
| 340 | + "google-cloud-core", |
| 341 | + "google-crc32c", |
| 342 | + "google-resumable-media", |
| 343 | + "opentelemetry-api", |
| 344 | + "protobuf", |
| 345 | + ] |
| 346 | + |
| 347 | + package_namespaces = { |
| 348 | + "google-api-core": "google.api_core", |
| 349 | + "google-auth": "google.auth", |
| 350 | + "google-cloud-core": "google.cloud.version", |
| 351 | + "opentelemetry-api": "opentelemetry.version", |
| 352 | + "protobuf": "google.protobuf", |
| 353 | + } |
| 354 | + |
| 355 | + for dep in prerel_deps: |
| 356 | + session.install("--pre", "--no-deps", "--upgrade", dep) |
| 357 | + print(f"Installed {dep}") |
| 358 | + |
| 359 | + version_namespace = package_namespaces.get(dep) |
| 360 | + |
| 361 | + if version_namespace: |
| 362 | + session.run( |
| 363 | + "python", |
| 364 | + "-c", |
| 365 | + f"import {version_namespace}; print({version_namespace}.__version__)", |
| 366 | + ) |
| 367 | + # Remaining dependencies |
| 368 | + other_deps = [ |
| 369 | + "requests", |
| 370 | + ] |
| 371 | + session.install(*other_deps) |
| 372 | + |
| 373 | + session.run( |
| 374 | + "py.test", |
| 375 | + "tests/unit", |
| 376 | + env={ |
| 377 | + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, |
| 378 | + }, |
| 379 | + ) |
| 380 | + |
| 381 | + session.run( |
| 382 | + "py.test", |
| 383 | + "--verbose", |
| 384 | + f"--junitxml=system_{session.python}_sponge_log.xml", |
| 385 | + os.path.join("tests", "system"), |
| 386 | + *session.posargs, |
| 387 | + env={ |
| 388 | + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, |
| 389 | + }, |
| 390 | + ) |
0 commit comments