@@ -74,22 +74,29 @@ test-core:
7474 pytest tests/unit/test_basic_queries.py tests/unit/test_cluster.py tests/unit/test_session.py -v -x
7575
7676# Critical path - MUST ALL PASS
77- test-critical : cassandra-wait
78- @echo " Running critical tests (including FastAPI)..."
79- pytest tests/unit -v -x -m " critical" || pytest tests/unit/test_critical_issues.py -v -x
77+ test-critical :
78+ @echo " Running critical tests..."
79+ @echo " === Running Critical Unit Tests (No Cassandra) ==="
80+ pytest tests/unit/test_critical_issues.py -v -x
81+ @echo " === Starting Cassandra for Integration Tests ==="
82+ $(MAKE ) cassandra-wait
83+ @echo " === Running Critical FastAPI Tests ==="
8084 pytest tests/fastapi_integration -v
8185 cd examples/fastapi_app && pytest tests/test_fastapi_app.py -v
82- pytest tests/bdd -m " critical" -v || pytest tests/bdd -v -x
86+ @echo " === Cleaning up Cassandra ==="
87+ $(MAKE ) cassandra-stop
8388
8489# Progressive execution - FAIL FAST
85- test-progressive : cassandra-wait
90+ test-progressive :
8691 @echo " Running tests in fail-fast order..."
87- @echo " === Running Core Unit Tests ==="
92+ @echo " === Running Core Unit Tests (No Cassandra) ==="
8893 @pytest tests/unit/test_basic_queries.py tests/unit/test_cluster.py tests/unit/test_session.py -v -x || exit 1
89- @echo " === Running Resilience Tests ==="
94+ @echo " === Running Resilience Tests (No Cassandra) ==="
9095 @pytest tests/unit/test_error_recovery.py tests/unit/test_retry_policy.py -v -x || exit 1
91- @echo " === Running Feature Tests ==="
96+ @echo " === Running Feature Tests (No Cassandra) ==="
9297 @pytest tests/unit/test_streaming.py tests/unit/test_prepared_statements.py -v || exit 1
98+ @echo " === Starting Cassandra for Integration Tests ==="
99+ @$(MAKE ) cassandra-wait || exit 1
93100 @echo " === Running Integration Tests ==="
94101 @pytest tests/integration -v || exit 1
95102 @echo " === Running FastAPI Integration Tests ==="
@@ -98,6 +105,8 @@ test-progressive: cassandra-wait
98105 @cd examples/fastapi_app && pytest tests/test_fastapi_app.py -v || exit 1
99106 @echo " === Running BDD Tests ==="
100107 @pytest tests/bdd -v || exit 1
108+ @echo " === Cleaning up Cassandra ==="
109+ @$(MAKE ) cassandra-stop
101110
102111# Test suite commands
103112test-resilience :
@@ -117,12 +126,19 @@ test-performance:
117126test-bdd : cassandra-wait
118127 @echo " Running BDD tests..."
119128 @mkdir -p reports
120- pytest tests/bdd -v --cucumber-json=reports/bdd.json
129+ pytest tests/bdd/ -v
121130
122131# Standard test command - runs everything except stress
123- test : cassandra-wait
132+ test :
124133 @echo " Running standard test suite..."
125- pytest tests/ -v -m " not stress"
134+ @echo " === Running Unit Tests (No Cassandra Required) ==="
135+ pytest tests/unit/ -v
136+ @echo " === Starting Cassandra for Integration Tests ==="
137+ $(MAKE ) cassandra-wait
138+ @echo " === Running Integration/FastAPI/BDD Tests ==="
139+ pytest tests/integration/ tests/fastapi_integration/ tests/bdd/ -v -m " not stress"
140+ @echo " === Cleaning up Cassandra ==="
141+ $(MAKE ) cassandra-stop
126142
127143test-unit :
128144 @echo " Running unit tests (no Cassandra required)..."
@@ -131,12 +147,12 @@ test-unit:
131147
132148test-integration : cassandra-wait
133149 @echo " Running integration tests..."
134- CASSANDRA_CONTACT_POINTS=$(CASSANDRA_CONTACT_POINTS ) pytest tests/integration/ -v -m integration
150+ CASSANDRA_CONTACT_POINTS=$(CASSANDRA_CONTACT_POINTS ) pytest tests/integration/ -v -m " not stress "
135151 @echo " Integration tests completed."
136152
137153test-integration-keep : cassandra-wait
138154 @echo " Running integration tests (keeping containers after tests)..."
139- KEEP_CONTAINERS=1 CASSANDRA_CONTACT_POINTS=$(CASSANDRA_CONTACT_POINTS ) pytest tests/integration/ -v -m integration
155+ KEEP_CONTAINERS=1 CASSANDRA_CONTACT_POINTS=$(CASSANDRA_CONTACT_POINTS ) pytest tests/integration/ -v -m " not stress "
140156 @echo " Integration tests completed. Containers are still running."
141157
142158test-fastapi : cassandra-wait
@@ -152,9 +168,39 @@ test-stress: cassandra-wait
152168 @echo " Stress tests completed."
153169
154170# Full test suite - EVERYTHING MUST PASS
155- test-all : lint cassandra-wait
171+ test-all : lint
156172 @echo " Running complete test suite..."
157- @./scripts/run_tests.sh all
173+ @echo " === Running Unit Tests (No Cassandra Required) ==="
174+ pytest tests/unit/ -v --cov=async_cassandra --cov-report=html --cov-report=xml
175+
176+ @echo "=== Running Integration Tests ==="
177+ $(MAKE) cassandra-stop || true
178+ $(MAKE) cassandra-wait
179+ pytest tests/integration/ -v -m "not stress"
180+
181+ @echo "=== Running FastAPI Integration Tests ==="
182+ $(MAKE) cassandra-stop
183+ $(MAKE) cassandra-wait
184+ pytest tests/fastapi_integration/ -v
185+
186+ @echo "=== Running BDD Tests ==="
187+ $(MAKE) cassandra-stop
188+ $(MAKE) cassandra-wait
189+ pytest tests/bdd/ -v
190+
191+ @echo "=== Running Example App Tests ==="
192+ $(MAKE) cassandra-stop
193+ $(MAKE) cassandra-wait
194+ cd examples/fastapi_app && pytest tests/ -v
195+
196+ @echo "=== Running Stress Tests ==="
197+ $(MAKE) cassandra-stop
198+ $(MAKE) cassandra-wait
199+ pytest tests/integration/ -v -m stress
200+
201+ @echo "=== Cleaning up Cassandra ==="
202+ $(MAKE) cassandra-stop
203+ @echo "✅ All tests completed!"
158204
159205# Code quality - MUST PASS
160206lint :
@@ -240,7 +286,7 @@ cassandra-wait:
240286 exit 1; \
241287 else \
242288 echo " Checking if Cassandra on $( CASSANDRA_CONTACT_POINTS) :$( CASSANDRA_PORT) can accept queries..." ; \
243- if [ " $( CASSANDRA_CONTACT_POINTS) " = " localhost " ] && $( CONTAINER_RUNTIME) ps --format " {{.Names}}" | grep -q " ^$( CASSANDRA_CONTAINER_NAME) $$ " ; then \
289+ if [ " $( CASSANDRA_CONTACT_POINTS) " = " 127.0.0.1 " ] && $( CONTAINER_RUNTIME) ps --format " {{.Names}}" | grep -q " ^$( CASSANDRA_CONTAINER_NAME) $$ " ; then \
244290 if ! $( CONTAINER_RUNTIME) exec $( CASSANDRA_CONTAINER_NAME) cqlsh -e " SELECT release_version FROM system.local" 2>&1 | grep -q " [0-9]" ; then \
245291 echo " Cassandra is running but not accepting queries yet, waiting..." ; \
246292 for i in $$ (seq 1 30); do \
0 commit comments