# How to Run Graphify Tests: A Complete pytest Guide

> Learn how to run Graphify tests with our complete pytest guide. Install Graphify in editable mode and execute pytest from the repository root to efficiently run all tests.

- Repository: [Graphify Labs/graphify](https://github.com/Graphify-Labs/graphify)
- Tags: how-to-guide
- Published: 2026-07-19

---

**Run Graphify tests by installing the package in editable mode with `pip install -e .`, installing pytest, and executing `pytest` from the repository root to discover all tests in the `tests/` directory.**

The Graphify repository (Graphify-Labs/graphify) ships with a comprehensive test suite that validates its knowledge-graph engine, language-specific resolvers, and HTTP serve layer. Learning how to run Graphify tests ensures that any modifications to the core graph logic or language parsers preserve existing functionality. This guide covers the exact commands, file locations, and pytest configurations used in the v8 codebase.

## Installation and Setup

Before executing tests, you must install the package and its dependencies. Graphify uses a modern Python packaging setup defined in [`pyproject.toml`](https://github.com/Graphify-Labs/graphify/blob/main/pyproject.toml) at the repository root.

Install the package in editable mode to ensure the test suite can import internal modules directly:

```bash
pip install -e .

```

If the project uses Poetry, run `poetry install` instead to handle dependency resolution.

Next, install the test runner and optional coverage tools. While [`pyproject.toml`](https://github.com/Graphify-Labs/graphify/blob/main/pyproject.toml) may declare these as development dependencies, you can install them explicitly:

```bash
pip install pytest pytest-cov

```

## Executing the Test Suite

From the repository root, invoke pytest to discover and run all files matching the `test_*.py` pattern inside the `tests/` directory:

```bash
pytest

```

### Common pytest Flags

Use these flags to control test execution and output:

- **`-v`** – Enables verbose output, showing individual test names as they pass or fail.
- **`-k "<expr>"`** – Runs only tests matching the expression. For example, `pytest -k "serve"` executes only tests in [`tests/test_serve.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_serve.py) and [`tests/test_serve_http.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_serve_http.py).
- **`--cov=graphify`** – Generates a coverage report for the `graphify` package, highlighting untested lines in the source code.

Example command with verbose output and coverage:

```bash
pytest -v --cov=graphify

```

## Test Structure and Coverage Areas

The `tests/` directory contains targeted test modules that mirror Graphify’s architecture. Understanding these categories helps you run specific subsets when debugging.

### Core Graph Operations

Tests like [`tests/test_zero_node_no_cache.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_zero_node_no_cache.py) and [`tests/test_word_count_cache.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_word_count_cache.py) validate node creation, caching mechanisms, and basic graph queries. These ensure the underlying graph engine correctly handles edge cases and cache invalidation.

### Language Resolvers

Graphify parses multiple programming languages, and the test suite verifies each resolver:

- **[`tests/test_swift_import_resolution.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_swift_import_resolution.py)** – Validates Swift symbol resolution.
- **[`tests/test_ts_inheritance.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_ts_inheritance.py)** – Checks TypeScript inheritance parsing.
- **[`tests/test_ruby_resolution.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_ruby_resolution.py)** – Confirms Ruby-specific resolution logic.

### HTTP Serve Layer

The [`tests/test_serve.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_serve.py) and [`tests/test_serve_http.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_serve_http.py) modules spin up temporary servers to verify request handling, routing, and response correctness. Run these with `pytest -k "serve"` when modifying the HTTP API in [`graphify/serve.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/serve.py).

### Skill Plugins

Dynamic skill loading is tested in [`tests/test_skillgen.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_skillgen.py) and [`tests/test_skill_version_warning.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_skill_version_warning.py). These ensure that plugins for VSCode, Windows, and Trae environments load correctly and handle version mismatches.

### Semantic Processing

[`tests/test_semantic_similarity.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_semantic_similarity.py) and [`tests/test_semantic_cleanup.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_semantic_cleanup.py) exercise the textual similarity utilities powering Graphify’s “semantic ID” feature, verifying that cleanup routines and similarity calculations produce consistent results.

## Interpreting Test Results

pytest displays a summary of passed, failed, and skipped tests upon completion. For failures, the traceback points directly to the source line triggering the error—whether in a resolver, the serve layer, or the core graph engine. This immediate feedback loop allows rapid identification of regressions in specific components like the Swift import resolver or the HTTP server implementation.

## Summary

- Install Graphify in editable mode using `pip install -e .` before running tests.
- Execute the full suite with `pytest` from the repository root.
- Target specific functionality using `-k` flags (e.g., `-k "serve"` for HTTP tests).
- Generate coverage reports with `--cov=graphify` to identify untested code paths.
- Key test files include [`tests/test_serve.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_serve.py) for the HTTP layer and [`tests/test_ts_inheritance.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_ts_inheritance.py) for language resolution.

## Frequently Asked Questions

### What test framework does Graphify use?

Graphify uses **pytest** as its test runner. The project defines test dependencies in [`pyproject.toml`](https://github.com/Graphify-Labs/graphify/blob/main/pyproject.toml), and all test files follow the `test_*.py` naming convention within the `tests/` package.

### How do I run only specific tests in Graphify?

Use the `-k` flag with a keyword expression. For example, `pytest -k "swift"` runs only tests matching "swift" (such as those in [`tests/test_swift_import_resolution.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_swift_import_resolution.py)), while `pytest -k "not serve"` excludes the HTTP server tests.

### Does Graphify include code coverage reporting?

Yes. Install `pytest-cov` and run `pytest --cov=graphify` to generate coverage reports. This analyzes the `graphify/` package source files and reports which lines are exercised by the test suite, including tests in [`tests/test_zero_node_no_cache.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_zero_node_no_cache.py) and other core modules.

### Where are the Graphify test files located?

All test files reside in the `tests/` directory at the repository root. Notable files include [`tests/__init__.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/__init__.py) (the test package initializer), [`tests/test_semantic_similarity.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_semantic_similarity.py) (semantic processing), and [`tests/test_skillgen.py`](https://github.com/Graphify-Labs/graphify/blob/main/tests/test_skillgen.py) (skill plugin generation).