Tecton Repo Fixture
The Tecton Repo Fixture is a pytest
fixture that provides methods to access
Tecton Objects defined in your feature repository that you might want to use in
your unit tests.
You can access the Repo Fixture by simply adding the repo_fixture
parameter to
your unit tests in the following manner:
from tecton import TestRepo
def test_tecton_objects(repo_fixture: TestRepo):
# Test code goes here
pass
The repo_fixture
is an object of type
TestRepo
. Please refer to the
SDK Reference to view all the
available methods and properties for the TestRepo
class.
This can be valuable to assert properties that have been set on your Tecton Objects and maintain consistency across all objects managed by your team.
from tecton import TestRepo, DeltaConfig
def test_tecton_objects(repo_fixture: TestRepo):
# Online and Offline Materialization is enabled on all FVs
for feature_view in repo_fixture.feature_views:
assert fv.online
assert fv.offline
# Feature view is using Delta as the Offline Store
fv = repo_fixture.get_feature_view("user_transactions_fv")
assert fv.offline_store == DeltaConfig
for tecton_object in repo_fixture.get_all_objects():
# Team's owner tags are set on all objects
object_tags = tecton_object.tags
assert object_tags["owner"] == "Feature Engineering"
# All objects should have descriptions
assert len(object_tags.description) > 0