From 3717bdde46978274c13ff89ca6dcacf802093610 Mon Sep 17 00:00:00 2001 From: Felix Wang Date: Thu, 30 Jun 2022 14:16:46 -0700 Subject: [PATCH 1/5] Test to trigger registry conflicts Signed-off-by: Felix Wang --- .../tests/unit/test_registry_conflict.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sdk/python/tests/unit/test_registry_conflict.py diff --git a/sdk/python/tests/unit/test_registry_conflict.py b/sdk/python/tests/unit/test_registry_conflict.py new file mode 100644 index 00000000000..5426ef47ab4 --- /dev/null +++ b/sdk/python/tests/unit/test_registry_conflict.py @@ -0,0 +1,22 @@ +import pytest + +from feast.entity import Entity + +@pytest.mark.integration +def test_apply_first_entity(environment): + entity = Entity(name="first") + fs = environment.feature_store + fs.apply([entity]) + + entities = fs.list_entities() + assert len(entities) == 1 + + +@pytest.mark.integration +def test_apply_second_entity(environment): + entity = Entity(name="second") + fs = environment.feature_store + fs.apply([entity]) + + entities = fs.list_entities() + assert len(entities) == 1 From 452396398047f266eb6d3bae3e53996a1fdd022e Mon Sep 17 00:00:00 2001 From: Felix Wang Date: Thu, 30 Jun 2022 17:00:00 -0700 Subject: [PATCH 2/5] Switch environment and associated fixtures to being function scoped Signed-off-by: Felix Wang --- sdk/python/tests/conftest.py | 8 ++++---- .../tests/integration/e2e/test_go_feature_server.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/python/tests/conftest.py b/sdk/python/tests/conftest.py index bf69a85fa31..5fe9b5b699d 100644 --- a/sdk/python/tests/conftest.py +++ b/sdk/python/tests/conftest.py @@ -161,7 +161,7 @@ def start_test_local_server(repo_path: str, port: int): fs.serve("localhost", port, no_access_log=True) -@pytest.fixture(scope="session") +@pytest.fixture def environment(request, worker_id): e = construct_test_environment( request.param, worker_id=worker_id, fixture_request=request @@ -293,7 +293,7 @@ def pytest_generate_tests(metafunc: pytest.Metafunc): ) -@pytest.fixture(scope="session") +@pytest.fixture def feature_server_endpoint(environment): if ( not environment.python_feature_server @@ -344,12 +344,12 @@ def _free_port(): return sock.getsockname()[1] -@pytest.fixture(scope="session") +@pytest.fixture def universal_data_sources(environment) -> TestData: return construct_universal_test_data(environment) -@pytest.fixture(scope="session") +@pytest.fixture def e2e_data_sources(environment: Environment): df = create_dataset() data_source = environment.data_source_creator.create_data_source( diff --git a/sdk/python/tests/integration/e2e/test_go_feature_server.py b/sdk/python/tests/integration/e2e/test_go_feature_server.py index 4fd003c1944..465fa41769e 100644 --- a/sdk/python/tests/integration/e2e/test_go_feature_server.py +++ b/sdk/python/tests/integration/e2e/test_go_feature_server.py @@ -35,7 +35,7 @@ ) -@pytest.fixture(scope="session") +@pytest.fixture def initialized_registry(environment, universal_data_sources): fs = environment.feature_store From 0b7c3d82d20cae18a73d51061101737c923bee17 Mon Sep 17 00:00:00 2001 From: Felix Wang Date: Fri, 1 Jul 2022 12:16:16 -0700 Subject: [PATCH 3/5] Format Signed-off-by: Felix Wang --- sdk/python/tests/unit/test_registry_conflict.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/python/tests/unit/test_registry_conflict.py b/sdk/python/tests/unit/test_registry_conflict.py index 5426ef47ab4..12f666556a1 100644 --- a/sdk/python/tests/unit/test_registry_conflict.py +++ b/sdk/python/tests/unit/test_registry_conflict.py @@ -2,6 +2,7 @@ from feast.entity import Entity + @pytest.mark.integration def test_apply_first_entity(environment): entity = Entity(name="first") From 9e27fce979e9c603bd4f1b7362b179160ea3b77f Mon Sep 17 00:00:00 2001 From: Felix Wang Date: Fri, 1 Jul 2022 12:19:24 -0700 Subject: [PATCH 4/5] Switch type tests to function-scoped fixtures Signed-off-by: Felix Wang --- .../tests/integration/registration/test_universal_types.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/python/tests/integration/registration/test_universal_types.py b/sdk/python/tests/integration/registration/test_universal_types.py index b03303f6eef..960423b33a1 100644 --- a/sdk/python/tests/integration/registration/test_universal_types.py +++ b/sdk/python/tests/integration/registration/test_universal_types.py @@ -65,7 +65,6 @@ class TypeTestConfig: @pytest.fixture( params=OFFLINE_TYPE_TEST_CONFIGS, - scope="session", ids=[str(c) for c in OFFLINE_TYPE_TEST_CONFIGS], ) def offline_types_test_fixtures(request, environment): @@ -81,7 +80,6 @@ def offline_types_test_fixtures(request, environment): @pytest.fixture( params=ONLINE_TYPE_TEST_CONFIGS, - scope="session", ids=[str(c) for c in ONLINE_TYPE_TEST_CONFIGS], ) def online_types_test_fixtures(request, environment): From 69b5352db9984822f85b18be60b3f145fb616d2c Mon Sep 17 00:00:00 2001 From: Felix Wang Date: Fri, 1 Jul 2022 15:00:55 -0700 Subject: [PATCH 5/5] Format Signed-off-by: Felix Wang --- .../tests/integration/registration/test_universal_types.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/python/tests/integration/registration/test_universal_types.py b/sdk/python/tests/integration/registration/test_universal_types.py index 960423b33a1..d5cf270b252 100644 --- a/sdk/python/tests/integration/registration/test_universal_types.py +++ b/sdk/python/tests/integration/registration/test_universal_types.py @@ -64,8 +64,7 @@ class TypeTestConfig: @pytest.fixture( - params=OFFLINE_TYPE_TEST_CONFIGS, - ids=[str(c) for c in OFFLINE_TYPE_TEST_CONFIGS], + params=OFFLINE_TYPE_TEST_CONFIGS, ids=[str(c) for c in OFFLINE_TYPE_TEST_CONFIGS], ) def offline_types_test_fixtures(request, environment): config: TypeTestConfig = request.param @@ -79,8 +78,7 @@ def offline_types_test_fixtures(request, environment): @pytest.fixture( - params=ONLINE_TYPE_TEST_CONFIGS, - ids=[str(c) for c in ONLINE_TYPE_TEST_CONFIGS], + params=ONLINE_TYPE_TEST_CONFIGS, ids=[str(c) for c in ONLINE_TYPE_TEST_CONFIGS], ) def online_types_test_fixtures(request, environment): return get_fixtures(request, environment)