@@ -385,21 +385,9 @@ def docfx(session):
385385
386386
387387@nox .session (python = DEFAULT_PYTHON_VERSION )
388- @nox .parametrize (
389- "protobuf_implementation" ,
390- ["python" , "upb" , "cpp" ],
391- )
392- def prerelease_deps (session , protobuf_implementation ):
388+ def prerelease_deps (session ):
393389 """Run all tests with prerelease versions of dependencies installed."""
394390
395- if protobuf_implementation == "cpp" and session .python in (
396- "3.11" ,
397- "3.12" ,
398- "3.13" ,
399- "3.14" ,
400- ):
401- session .skip ("cpp implementation is not supported in python 3.11+" )
402-
403391 # Install all dependencies
404392 session .install ("-e" , ".[all, tests, tracing]" )
405393 unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -431,71 +419,71 @@ def prerelease_deps(session, protobuf_implementation):
431419 session .install (* constraints_deps )
432420
433421 prerel_deps = [
434- "protobuf" ,
435- # dependency of grpc
436- "six" ,
437- "grpc-google-iam-v1" ,
438- "googleapis-common-protos" ,
439- "grpcio" ,
440- "grpcio-status" ,
441- "google-api-core" ,
442422 "google-auth" ,
443- "proto-plus" ,
444- "google-cloud-testutils" ,
445- # dependencies of google-cloud-testutils"
446- "click" ,
423+ "requests-oauthlib" ,
447424 ]
448425
449426 for dep in prerel_deps :
450427 session .install ("--pre" , "--no-deps" , "--upgrade" , dep )
451428
452- # Remaining dependencies
453- other_deps = [
454- "requests" ,
455- ]
456- session .install (* other_deps )
457-
458429 # Print out prerelease package versions
459- session .run (
460- "python" , "-c" , "import google.protobuf; print(google.protobuf.__version__)"
461- )
462- session .run ("python" , "-c" , "import grpc; print(grpc.__version__)" )
463430 session .run ("python" , "-c" , "import google.auth; print(google.auth.__version__)" )
464431
465432 session .run (
466433 "py.test" ,
467434 "tests/unit" ,
468- env = {
469- "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" : protobuf_implementation ,
470- },
471435 )
472436
473- system_test_path = os .path .join ("tests" , "system.py" )
474- system_test_folder_path = os .path .join ("tests" , "system" )
475437
476- # Only run system tests if found.
477- if os .path .exists (system_test_path ):
478- session .run (
479- "py.test" ,
480- "--verbose" ,
481- f"--junitxml=system_{ session .python } _sponge_log.xml" ,
482- system_test_path ,
483- * session .posargs ,
484- env = {
485- "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" : protobuf_implementation ,
486- },
487- )
488- if os .path .exists (system_test_folder_path ):
489- session .run (
490- "py.test" ,
491- "--verbose" ,
492- f"--junitxml=system_{ session .python } _sponge_log.xml" ,
493- system_test_folder_path ,
494- * session .posargs ,
495- env = {
496- "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" : protobuf_implementation ,
497- },
438+ @nox .session (python = DEFAULT_PYTHON_VERSION )
439+ def core_deps_from_source (session ):
440+ """Run all tests with core dependencies installed from source
441+ rather than pulling the dependencies from PyPI.
442+ """
443+
444+ # Install all dependencies
445+ session .install ("-e" , ".[all, tests, tracing]" )
446+ unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
447+ session .install (* unit_deps_all )
448+ system_deps_all = (
449+ SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
450+ )
451+ session .install (* system_deps_all )
452+
453+ # Because we test minimum dependency versions on the minimum Python
454+ # version, the first version we test with in the unit tests sessions has a
455+ # constraints file containing all dependencies and extras.
456+ with open (
457+ CURRENT_DIRECTORY
458+ / "testing"
459+ / f"constraints-{ UNIT_TEST_PYTHON_VERSIONS [0 ]} .txt" ,
460+ encoding = "utf-8" ,
461+ ) as constraints_file :
462+ constraints_text = constraints_file .read ()
463+
464+ # Ignore leading whitespace and comment lines.
465+ constraints_deps = [
466+ match .group (1 )
467+ for match in re .finditer (
468+ r"^\s*(\S+)(?===\S+)" , constraints_text , flags = re .MULTILINE
498469 )
470+ ]
471+
472+ session .install (* constraints_deps )
473+
474+ core_dependencies_from_source = [
475+ "google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
476+ "requests-oauthlib @ git+https://github.com/requests/requests-oauthlib.git" ,
477+ ]
478+
479+ for dep in core_dependencies_from_source :
480+ session .install (dep , "--no-deps" , "--ignore-installed" )
481+ print (f"Installed { dep } " )
482+
483+ session .run (
484+ "py.test" ,
485+ "tests/unit" ,
486+ )
499487
500488
501489@nox .session (python = DEFAULT_PYTHON_VERSION )
0 commit comments