Skip to content

Commit cd1b18e

Browse files
committed
enhace phase I
1 parent f38c798 commit cd1b18e

File tree

9 files changed

+76
-2
lines changed

9 files changed

+76
-2
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ logs/
3333
models/
3434
*.log
3535

36+
# Test artifacts
37+
tests/env/tmp/
38+
tests/**/*.tmp
39+
tests/**/*.temp
40+
tests/**/__pycache__/
41+
.pytest_cache/
42+
.coverage
43+
htmlcov/
44+
*.coverage
45+
3646
# Temporary files
3747
*.tmp
3848
*.temp

commands/subs/dev/precommit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def precommit(fix: bool, ci: bool) -> None:
9090
# 4. Run tests if in CI mode
9191
if ci:
9292
click.echo("\n🧪 Running tests...")
93-
test_cmd = ["pytest", "commands/tests/"]
93+
test_cmd = ["pytest", "tests/commands/"]
9494
result = subprocess.run(test_cmd, capture_output=True, text=True)
9595
if result.returncode != 0:
9696
click.echo(" ✗ Tests failed")

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cli = "commands.main:main"
3030
[tool.setuptools.packages.find]
3131
where = ["."]
3232
include = ["commands", "commands.*"]
33-
exclude = ["commands.tests*"]
33+
exclude = ["tests*"]
3434

3535
[tool.setuptools.dynamic]
3636
version = {attr = "commands.__version__"}
@@ -69,3 +69,9 @@ warn_return_any = true
6969
warn_unused_configs = true
7070
disallow_untyped_defs = true
7171
ignore_missing_imports = true
72+
73+
[tool.pytest.ini_options]
74+
testpaths = ["tests"]
75+
python_files = ["test_*.py"]
76+
python_classes = ["Test*"]
77+
python_functions = ["test_*"]

tests/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Tests Directory Structure
2+
3+
This directory contains all test-related files organized by functionality.
4+
5+
## Directory Structure
6+
7+
```
8+
tests/
9+
├── commands/ # Unit tests for CLI commands (moved from commands/tests/)
10+
├── docker/ # Docker-related test configurations
11+
├── env/ # Test environment setups and fixtures
12+
├── integration/ # Integration tests
13+
├── rust/ # Rust-related tests (when applicable)
14+
└── e2e/ # End-to-end tests (future)
15+
```
16+
17+
## Test Categories
18+
19+
### commands/
20+
Unit tests for all CLI commands. These test individual command functionality in isolation.
21+
22+
### docker/
23+
Contains Docker Compose files and Dockerfiles for testing the application in containerized environments.
24+
25+
### env/
26+
Test environment configurations, fixtures, and temporary test data. Virtual environments for testing should be created here.
27+
28+
### integration/
29+
Integration tests that test multiple components working together.
30+
31+
### rust/ (future)
32+
Tests for Rust components when building mixed-language projects.
33+
34+
## Running Tests
35+
36+
```bash
37+
# Run all tests
38+
cli dev test
39+
40+
# Run with coverage
41+
pytest --cov=commands
42+
43+
# Run specific test category
44+
pytest tests/commands/
45+
pytest tests/integration/
46+
```
47+
48+
## Test Conventions
49+
50+
1. **Naming**: Test files should be named `test_*.py`
51+
2. **Structure**: Mirror the source code structure within each test category
52+
3. **Isolation**: Each test should be independent and not rely on other tests
53+
4. **Cleanup**: Tests should clean up any temporary files or directories they create
54+
5. **Documentation**: Complex tests should include docstrings explaining what they test
55+
56+
## Temporary Files
57+
58+
Any temporary files or directories created during testing should be placed in `tests/env/tmp/` and cleaned up after the test completes.

0 commit comments

Comments
 (0)