diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index 8b996be11a..2e0c99ef12 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -1,11 +1,9 @@ # Format: //devtools/kokoro/config/proto/build.proto -# Run all sessions except system tests and docs builds -# This only runs unit tests for Python 3.10 since unit tests are required for `cover` to run -# Other Python version unit tests are run separately +# Run fast linting and code formatting checks env_vars: { key: "NOX_SESSION" - value: "unit-3.10 lint lint_setup_py blacken cover" + value: "lint lint_setup_py blacken" } # Run unit tests in parallel, splitting up by file diff --git a/noxfile.py b/noxfile.py index ce2d2c3865..4d3dac6d56 100644 --- a/noxfile.py +++ b/noxfile.py @@ -208,11 +208,6 @@ def default(session): "py.test", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", - "--cov=google", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", "--ignore=tests/unit/vertex_ray", "--ignore=tests/unit/vertex_adk", "--ignore=tests/unit/vertex_langchain", diff --git a/tests/unit/vertexai/test_offline_store.py b/tests/unit/vertexai/test_offline_store.py index 7183936450..a3e6f5b3c9 100644 --- a/tests/unit/vertexai/test_offline_store.py +++ b/tests/unit/vertexai/test_offline_store.py @@ -22,8 +22,6 @@ from google import auth from vertexai.resources.preview.feature_store import ( offline_store, - FeatureGroup, - Feature, ) pytestmark = [ @@ -266,7 +264,7 @@ def mock_session(bigframes_import_mock): @pytest.fixture() def mock_fg(): - with mock.patch.object(FeatureGroup, "__new__") as mock_fg: + with mock.patch.object(offline_store, "FeatureGroup") as mock_fg: yield mock_fg @@ -284,7 +282,7 @@ def create_mock_fg( @pytest.fixture() def mock_feature(): - with mock.patch.object(Feature, "__new__") as mock_feature: + with mock.patch.object(offline_store, "Feature") as mock_feature: yield mock_feature @@ -507,7 +505,6 @@ def test_one_feature_with_explicit_credentials( # Ensure when getting the FeatureGroup and Feature, the credentials are # passed through. mock_fg.assert_called_once_with( - FeatureGroup, "fake", project=None, credentials=credentials, diff --git a/vertexai/resources/preview/feature_store/offline_store.py b/vertexai/resources/preview/feature_store/offline_store.py index 3a785711e4..e381a9a307 100644 --- a/vertexai/resources/preview/feature_store/offline_store.py +++ b/vertexai/resources/preview/feature_store/offline_store.py @@ -256,14 +256,14 @@ def fetch_historical_feature_values( feature_data: List[impl.DataSource] = [] for feature in features: - if isinstance(feature, Feature): - feature_group = _get_feature_group_from_feature(feature, credentials) - feature_data.append(_feature_to_data_source(feature_group, feature)) - elif isinstance(feature, str): + if isinstance(feature, str): feature_group, feature = _extract_feature_from_str_repr( feature, credentials ) feature_data.append(_feature_to_data_source(feature_group, feature)) + elif isinstance(feature, Feature): + feature_group = _get_feature_group_from_feature(feature, credentials) + feature_data.append(_feature_to_data_source(feature_group, feature)) else: raise ValueError( f"Unsupported feature type {type(feature)} found in feature list. Feature: {feature}"