agentleFS
NVIDIAKnown publisherNVIDIA/NeMo-Agent-Toolkit/.cursor/rules/nat-tests/general.mdc

NeMo-Agent-Toolkit / nat-tests

Cursor rule2.7k starsChanged 16 months agoApache-2.0View on GitHub

Follow these rules when the user's request involves writing, creating, or modifying tests for NeMo Agent Toolkit

Trending

Quiet since August.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 4 mentionsMay 2026: 2 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the NVIDIA/NeMo-Agent-Toolkit repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about NVIDIA/NeMo-Agent-Toolkit

The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 15

Talked about on GitHub (15 times).

On GitHub · 15

10 more on GitHub

The file

We split this general.mdc into the rules it gives an agent

11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow these rules when writing, creating, or modifying tests for NeMo Agent Toolkit.

    line 9
  2. Distinctive:

    All tests in NeMo Agent Toolkit use pytest.

    line 20
  3. Very specific:

    Use pytest for all unit tests

    line 24
  4. Very specific:

    Do NOT add @pytest.mark.asyncio to any test - async tests are automatically detected and run by the async runner

    line 28
  5. Very specific:

    Use @pytest.fixture(name="fixture_name") decorator pattern

    line 31
  6. Very specific:

    Use @pytest.mark.slow and @pytest.mark.integration decorators

    line 54
  7. Very specific:

    Use API key fixtures from nvidia-nat-test package

    line 55
  8. Very specific:

    Use locate_example_config() and run_workflow() utilities

    line 56
  9. Distinctive:

    No API keys or external services required

    line 68
  10. Distinctive:

    Always use the user's current virtual environment when running tests.

    line 74
  11. Distinctive:

    Always include a package subdirectory or multiple subdirectories when invoking pytest.

    line 76

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
general.mdc
---
description: Follow these rules when the user's request involves writing, creating, or modifying tests for NeMo Agent Toolkit
globs:
alwaysApply: false
---

# Testing Guidelines for NeMo Agent Toolkit

Follow these rules when writing, creating, or modifying tests for NeMo Agent Toolkit.

## Referenced Documentation

- **Running Tests Guide**: [running-tests.md](mdc:docs/source/resources/running-tests.md) - Complete guide for running unit and integration tests
- **Test Fixtures**: [plugin.py](mdc:packages/nvidia_nat_test/src/nat/test/plugin.py) - Test fixtures
- **Test Utilities**: [utils.py](mdc:packages/nvidia_nat_test/src/nat/test/utils.py) - Test utilities
- **Docker Services**: [docker-compose.services.yml](mdc:tests/test_data/docker-compose.services.yml) - Services for integration testing

## General Testing Rules

All tests in NeMo Agent Toolkit use pytest. See the general coding guidelines for basic testing requirements.

### Unit Tests

- Use `pytest` for all unit tests
- Name test files `test_*.py`
- Mock external services with `pytest_httpserver` or `unittest.mock`
- Maintain ≥ 80% code coverage
- Do NOT add `@pytest.mark.asyncio` to any test - async tests are automatically detected and run by the async runner

### Fixtures
- Use `@pytest.fixture(name="fixture_name")` decorator pattern
- Fixtures that are used in multiple tests should be defined in the `packages/nvidia_nat_test/src/nat/test/plugin.py` file, fixtures specific to a single package should be defined in a `conftest.py` file in the `tests` directory of the package, and fixtures that are specific to a single test can be defined in the test file itself.

#### Available Fixtures

**API Keys**: `nvidia_api_key`, `openai_api_key`, `tavily_api_key`, `mem0_api_key`

**Services**: `milvus_uri`, `redis_url`, `mysql_connection_info`, `phoenix_url`

**Directories**: `root_repo_dir`, `examples_dir` (NAT repo only)

**Mocked Objects**: `mock_httpx_async_client`, `mock_httpx_sync_client`, `mock_builder`

There are many more fixtures available, refer to the [plugin.py](mdc:packages/nvidia_nat_test/src/nat/test/plugin.py) file and any `conftest.py` files defined in the file hierarchy of the current test file for the complete list.

### Integration Tests

For workflows that require actual LLM services or external services, follow the integration testing guidelines:

**See**: [Integration Testing Guidelines](mdc:.cursor/rules/nat-tests/integration-tests.mdc)

Key requirements:

- Use `@pytest.mark.slow` and `@pytest.mark.integration` decorators
- Use API key fixtures from `nvidia-nat-test` package
- Use `locate_example_config()` and `run_workflow()` utilities
- Service fixtures ensure services are running before tests execute

### Test LLM (nat_test_llm)

For deterministic testing without requiring actual LLM API calls, use the `nat_test_llm`:

**See**: [Test LLM Guidelines](mdc:.cursor/rules/nat-tests/nat-test-llm.mdc)

Key features:

- Stub LLM responses with predictable sequences
- No API keys or external services required
- Configurable artificial latency for testing timing scenarios
- Works with all framework wrappers (LangChain, LlamaIndex, CrewAI, etc.)

### Running Tests

Always use the user's current virtual environment when running tests.

Always include a package subdirectory or multiple subdirectories when invoking pytest.

```bash
# Unit tests only (default)
pytest packages/nvidia_nat_core

# Include slow tests
pytest --run_slow packages/nvidia_nat_core packages/nvidia_nat_langchain

# Include integration tests
pytest --run_integration packages/nvidia_nat_core

# All tests
pytest --run_slow --run_integration packages/nvidia_nat_langchain
```

## Related Rules

- **Integration Tests**: [integration-tests.mdc](mdc:.cursor/rules/nat-tests/integration-tests.mdc) - Detailed integration testing guidelines
- **Test LLM**: [nat-test-llm.mdc](mdc:.cursor/rules/nat-tests/nat-test-llm.mdc) - Using nat_test_llm to simulate deterministic LLM responses
- **General Guidelines**: [general.mdc](mdc:.cursor/rules/general.mdc) - Overall coding and testing standards

## Quick Reference

### Test Decorators

- `@pytest.mark.slow` - Tests taking >30 seconds
- `@pytest.mark.integration` - Tests requiring external services
- `@pytest.mark.usefixtures("api_key_name")` - Test requires a specific API key to be set in the environment

### Test Utilities

- `locate_example_config(ConfigClass)` - Find config files
- `run_workflow(config_file, question, expected_answer)` - Run and validate workflows
- `load_config(config_file)` - Load configuration objects

### Test LLM

- `_type: nat_test_llm` - Use in YAML configs to stub LLM responses
- `TestLLMConfig(response_seq=[...], delay_ms=0)` - Programmatic test LLM configuration

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.