Skip to content

Commit 770f3c5

Browse files
author
Tom Softreck
committed
update
1 parent 9c7d6a0 commit 770f3c5

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ help:
2323
@echo " docker - Build Docker image"
2424
@echo " run-example - Run an example (use EXAMPLE=name)"
2525
@echo " list-examples - List available examples"
26+
@echo " logs - View recent logs (use: make logs LINES=50)"
2627
@echo " view-logs - View logs for running example"
2728
@echo " stop-example - Stop a running example"
2829
@echo " docs - Generate documentation"
2930
@echo " setup-env - Create example .env file"
31+
@echo ""
32+
@echo "Testing commands:"
33+
@echo " test-unit - Run unit tests"
34+
@echo " test-integration - Run integration tests"
35+
@echo " test-e2e - Run end-to-end tests"
36+
@echo " coverage - Generate test coverage report"
3037

3138
# Installation
3239
install:
@@ -148,6 +155,18 @@ version:
148155
git tag -a "v$$(poetry version --short)" -m "Version $$(poetry version --short)"
149156
@echo "✅ Version bumped and tagged. Don't forget to push with tags: git push --follow-tags"
150157

158+
# View recent logs from the application
159+
LINES ?= 50 # Default number of lines to show
160+
LOG_DIR ?= logs # Default log directory
161+
162+
logs:
163+
@echo "📋 Showing last $(LINES) lines of logs from $(LOG_DIR)/"
164+
@if [ -d "$(LOG_DIR)" ]; then \
165+
find "$(LOG_DIR)" -type f -name "*.log" -exec sh -c 'echo "\n📄 {}:"; tail -n $(LINES) {}' \; 2>/dev/null || echo "No log files found in $(LOG_DIR)/"; \
166+
else \
167+
echo "Log directory $(LOG_DIR)/ does not exist"; \
168+
fi
169+
151170
# Helper to get PYPI_TOKEN from files
152171
define get_pypi_token
153172
$(shell \

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,83 @@
1111
[![Tests](https://github.com/dialogchain/python/actions/workflows/tests.yml/badge.svg)](https://github.com/dialogchain/python/actions/workflows/tests.yml)
1212
[![codecov](https://codecov.io/gh/dialogchain/python/graph/badge.svg?token=YOUR-TOKEN-HERE)](https://codecov.io/gh/dialogchain/python)
1313

14+
## 🧪 Testing DialogChain
15+
16+
DialogChain includes a comprehensive test suite to ensure code quality and functionality. Here's how to run the tests and view logs:
17+
18+
### Running Tests
19+
20+
Run the complete test suite:
21+
22+
```bash
23+
make test
24+
```
25+
26+
Or run specific test types:
27+
28+
```bash
29+
# Unit tests
30+
make test-unit
31+
32+
# Integration tests
33+
make test-integration
34+
35+
# End-to-end tests
36+
make test-e2e
37+
```
38+
39+
### Viewing Test Coverage
40+
41+
Generate a coverage report to see which parts of your code are being tested:
42+
43+
```bash
44+
make coverage
45+
```
46+
47+
This will generate an HTML report in the `htmlcov` directory.
48+
49+
### Viewing Logs
50+
51+
View the most recent logs from your application:
52+
53+
```bash
54+
# Show last 50 lines from all log files
55+
make logs
56+
57+
# Show a different number of lines
58+
make logs LINES=100
59+
60+
# Specify a custom log directory
61+
make logs LOG_DIR=/path/to/logs
62+
```
63+
64+
### Linting and Code Style
65+
66+
Ensure your code follows the project's style guidelines:
67+
68+
```bash
69+
# Run linters
70+
make lint
71+
72+
# Automatically format your code
73+
make format
74+
75+
# Check types
76+
make typecheck
77+
```
78+
79+
### Running in Docker
80+
81+
You can also run tests in a Docker container:
82+
83+
```bash
84+
# Build the Docker image
85+
docker build -t dialogchain .
86+
87+
# Run tests in the container
88+
docker run --rm dialogchain make test
89+
```
90+
1491
## 🔍 Network Scanning & Printing
1592

1693
DialogChain includes powerful network scanning capabilities to discover devices like cameras and printers on your local network.

0 commit comments

Comments
 (0)