Compare commits
No commits in common. '36a1a60c2d999bce3d50046adb262c403484b89e' and 'f26c4a736f21c493f71ab45caa38872eb9551d2b' have entirely different histories.
36a1a60c2d
...
f26c4a736f
@ -1,44 +0,0 @@
|
|||||||
# Unit Testing Guide - be-lcca
|
|
||||||
|
|
||||||
This document provides instructions on how to set up and run unit tests for the **be-lcca** project.
|
|
||||||
|
|
||||||
## 1. Preparation
|
|
||||||
|
|
||||||
### Install Dependencies
|
|
||||||
Ensure you have all dependencies installed. This project uses `poetry`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install dependencies
|
|
||||||
poetry install
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. Configuration
|
|
||||||
|
|
||||||
### Pytest Configuration
|
|
||||||
Ensure the `pytest.ini` file in the root directory points to the `unit` test folder:
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[pytest]
|
|
||||||
testpaths = tests/unit
|
|
||||||
python_files = test_*.py
|
|
||||||
asyncio_mode = auto
|
|
||||||
```
|
|
||||||
|
|
||||||
## 3. Running Tests
|
|
||||||
|
|
||||||
### Run Unit Tests
|
|
||||||
To run all unit tests in the project:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
poetry run pytest tests/unit
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run Specific Unit Test File
|
|
||||||
```bash
|
|
||||||
poetry run pytest tests/unit/test_specific_feature.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. Best Practices
|
|
||||||
|
|
||||||
- **Isolation**: Ensure tests do not rely on a live database; use local data structures or mock objects.
|
|
||||||
- **Factory Boy**: Use factories for creating complex models in your tests.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
[pytest]
|
|
||||||
testpaths = tests/unit
|
|
||||||
python_files = test_*.py
|
|
||||||
asyncio_mode = auto
|
|
||||||
Loading…
Reference in New Issue