@@ -697,10 +697,53 @@ def mypy(session):
697697
698698
699699@nox .session (python = DEFAULT_PYTHON_VERSION )
700- def core_deps_from_source (session ):
700+ @nox .parametrize (
701+ "protobuf_implementation" ,
702+ ["python" , "upb" ],
703+ )
704+ @_calculate_duration
705+ def core_deps_from_source (session , protobuf_implementation ):
701706 """Run all tests with core dependencies installed from source
702707 rather than pulling the dependencies from PyPI.
703708 """
704- # TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
705- # Add core deps from source tests
706- session .skip ("Core deps from source tests are not yet supported" )
709+ constraints_path = str (
710+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
711+ )
712+ install_unittest_dependencies (session , "-c" , constraints_path )
713+
714+ # Mimic unit session install target
715+ if session .python in ["3.11" , "3.12" , "3.13" , "3.14" ]:
716+ install_target = ".[geography,alembic,tests,bqstorage]"
717+ else :
718+ install_target = ".[all]"
719+ session .install ("-e" , install_target , "-c" , constraints_path )
720+
721+ core_dependencies_from_source = [
722+ "googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos" ,
723+ "google-api-core @ git+https://github.com/googleapis/google-cloud-python#egg=google-api-core&subdirectory=packages/google-api-core" ,
724+ "google-auth @ git+https://github.com/googleapis/google-cloud-python#egg=google-auth&subdirectory=packages/google-auth" ,
725+ "grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1" ,
726+ "proto-plus @ git+https://github.com/googleapis/google-cloud-python#egg=proto-plus&subdirectory=packages/proto-plus" ,
727+ ]
728+
729+ for dep in core_dependencies_from_source :
730+ session .install (dep , "--no-deps" , "--ignore-installed" )
731+ print (f"Installed { dep } " )
732+
733+ tests_path = os .path .join ("tests" , "unit" )
734+ session .run (
735+ "py.test" ,
736+ "--quiet" ,
737+ f"--junitxml=unit_{ session .python } _sponge_log.xml" ,
738+ "--cov=sqlalchemy_bigquery" ,
739+ "--cov=tests/unit" ,
740+ "--cov-append" ,
741+ "--cov-config=.coveragerc" ,
742+ "--cov-report=" ,
743+ "--cov-fail-under=0" ,
744+ tests_path ,
745+ * session .posargs ,
746+ env = {
747+ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" : protobuf_implementation ,
748+ },
749+ )
0 commit comments