Skip to content

Tesing : Create a common fixture in conftest.py for seeding database #268

@nishika26

Description

@nishika26

Describe the bug
Currently, different test files implement their own ad-hoc ways to seed the database for tests. This has led to duplicated code, inconsistent data setup, and brittle tests. The lack of a common, shared fixture for database seeding is making the test suite messy and causing test failures and maintenance overhead.

Expected behavior
There should be a single, reusable fixture in conftest.py that seeds the database in a consistent and predictable way for all tests. This would eliminate duplication, reduce test flakiness, and make tests easier to maintain.

Additional context

We should Consider using:

  • @pytest.fixture(scope="session") or scope="class" depending on isolation needs

  • For scenarios that need additional data beyond what’s provided in seed_data.json, we’ll create generic utility functions to generate this data instead of hardcoding it for every test cases

Sub-issues

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions