tecton-unit-testing

A set of rules for writing or changing unit tests for Tecton FeatureViews, which are definitions of data features used in machine-learning systems. It explains how to validate plans and avoid requiring live Tecton services during tests.

In plain words
What is it for?
Use it when creating Tecton tests: run tecton plan first, skip object validation for mock inputs when needed, and retrieve FeatureViews through the TestRepo fixture.
Why use it?
It prevents tests from depending on a Tecton API or compute cluster that may not be available in a unit-testing environment. It also standardizes how tests obtain the FeatureView under test.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/tecton-ai/tecton-mcp/tecton-unit-testing
Clone the repo
git clone --depth 1 https://github.com/tecton-ai/tecton-mcp

Made for: Cursor.

Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,426 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.05426
Opus 5 $0.00006 $0.02713
Sonnet 5 $0.00003 $0.01085
Haiku 4.5 $0.00001 $0.00543

Measured 3d ago against content hash 548a2bbf8c78, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tecton-unit-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/tecton-unit-testing.mdc · 559 lines

How it starts

The opening of the file, as written. The whole thing — 559 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rules to follow when you create Tecton FeatureView unit tests

CRITICAL: Before adding a new unit test, make sure that tecton plan works. This ensures the Feature View definitions are at least valid.

Feature retrieval methods such as get_features_in_range and run_transformation use validated Tecton Objects during retrieval by default. Validation requires access to the Tecton API and a Compute Cluster which are often unavailable in Unit Testing environments.

    To use these methods using mock inputs **without validation** in Unit Tests, set the validation mode to `skip` using:
    ```
    conf.set("TECTON_SKIP_OBJECT_VALIDATION", "True")
    ```

In your unit test for a given FeatureView, always fetch a reference to the FeatureView using the TestRepo test fixture. Never try to import it directly from the module. Sample code that shows how to use repo_fixture.get_feature_view to retrieve the unit under test:

### tests/transaction_amount_is_high.py ###
from tecton import TestRepo
import pandas

# Testing the 'transaction_amount_is_high' feature which depends on request data ('amount') as input
def test_transaction_amount_is_high(repo_fixture: TestRepo):
    transaction_amount_is_high = repo_fixture.get_feature_view("transaction_amount_is_high")
    transaction_request = pandas.DataFrame({"amount": [124, 10001, 34235436234]})

    # Use a MockContext to mock any secrets or resources
    mock_context = MockContext(secrets={"my_secret": "my_secret_value"})
    actual = transaction_amount_is_high.run_transformation(
        input_data={
            "transaction_request": transaction_request,
            "context": mock_context,
        },
    ).to_pandas()

    expected = pandas.DataFrame({"transaction_amount_is_high": [0, 1, 1]})
    pandas.testing.assert_frame_equal(actual, expected)

Overview

Tecton supports unit testing for feature definitions to ensure the correctness of feature definitions. Unit tests can be defined in feature repositories in file paths matching the pattern **/tests/*.py.

Read the full file on GitHub · 559 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 559 lines · 13 tokens per session scan A 548a2bbf8c78

Subscribe to this mod's changes

tecton-unit-testing is a cursor rule published in the GitHub repository tecton-ai/tecton-mcp (3 stars, last pushed 1y ago), licensed MIT. It adds 13 tokens to every session and 5,426 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.