conftest.py

Overview

conftest.py is a configuration file used by the pytest testing framework. It defines reusable fixtures that provide setup and teardown logic for tests related to dataset management in the InfiniFlow project. Specifically, it offers two fixtures to create datasets before tests run and ensure cleanup by deleting those datasets afterward, maintaining a clean test environment.

This file leverages the batch_create_datasets utility from the common module to generate multiple datasets via a client object, which presumably interacts with the InfiniFlow backend or API.

Detailed Explanation

Imports


Fixtures

1. add_datasets


2. add_datasets_func


Implementation Details

Interaction with Other Parts of the System

Summary

conftest.py is an essential test configuration file that provides dataset management fixtures to ensure reliable, isolated, and repeatable tests for operations involving datasets. By centralizing dataset setup and cleanup, it helps maintain test hygiene and reduces boilerplate in individual test modules.


Mermaid Diagram

flowchart TD
    A[conftest.py] --> B[add_datasets (class scope)]
    A --> C[add_datasets_func (function scope)]

    B --> D[batch_create_datasets(client, 5)]
    C --> E[batch_create_datasets(client, 3)]

    B --> F[Cleanup: client.delete_datasets(ids=None)]
    C --> G[Cleanup: client.delete_datasets(ids=None)]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style B fill:#bbf,stroke:#333
    style C fill:#bbf,stroke:#333
    style D fill:#afa,stroke:#333
    style E fill:#afa,stroke:#333
    style F fill:#faa,stroke:#333
    style G fill:#faa,stroke:#333

Summary Table

Fixture Name

Scope

Creates Datasets

Number Created

Cleanup Action

Usage Context

add_datasets

class

Yes

5

Deletes all datasets after class

Shared datasets per class

add_datasets_func

function

Yes

3

Deletes all datasets after function

Isolated datasets per test


Notes