Skip to content

Commit c3daf98

Browse files
committed
test consolidation
1 parent 7674aee commit c3daf98

File tree

9 files changed

+2579
-1839
lines changed

9 files changed

+2579
-1839
lines changed

duplicate_analysis.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Duplicate Test Analysis
2+
3+
## Tests in Original Files vs Consolidated File
4+
5+
### test_batch_operations.py (Original)
6+
1. **test_logged_batch** - Tests logged batch operations with prepared statements
7+
2. **test_unlogged_batch** - Tests unlogged batch for performance
8+
3. **test_counter_batch** - Tests counter batch operations
9+
4. **test_mixed_batch_types_error** - Tests mixing regular and counter operations error
10+
5. **test_batch_with_prepared_statements** - Tests batches with prepared statements
11+
6. **test_batch_consistency_levels** - Tests batch operations with different consistency levels
12+
7. **test_large_batch_warning** - Tests large batch size warnings
13+
8. **test_conditional_batch** - Tests batch with conditional statements (LWT)
14+
9. **test_counter_batch_concurrent** - Tests concurrent counter batch operations
15+
10. **test_batch_with_custom_timestamp** - Tests batch operations with custom timestamp
16+
17+
### test_lwt_operations.py (Integration - Original)
18+
1. **test_insert_if_not_exists_success** - Tests successful INSERT IF NOT EXISTS
19+
2. **test_insert_if_not_exists_conflict** - Tests INSERT IF NOT EXISTS when row exists
20+
3. **test_update_if_condition_match** - Tests conditional UPDATE when condition matches
21+
4. **test_update_if_condition_no_match** - Tests conditional UPDATE when condition doesn't match
22+
5. **test_delete_if_exists_success** - Tests DELETE IF EXISTS when row exists
23+
6. **test_delete_if_exists_not_found** - Tests DELETE IF EXISTS when row doesn't exist
24+
7. **test_concurrent_inserts_if_not_exists** - Tests concurrent INSERT IF NOT EXISTS
25+
8. **test_optimistic_locking_pattern** - Tests optimistic locking pattern using LWT
26+
9. **test_complex_condition_with_multiple_columns** - Tests LWT with conditions on multiple columns
27+
10. **test_prepared_statements_with_lwt** - Tests LWT operations with prepared statements
28+
11. **test_lwt_error_handling** - Tests error handling in LWT operations
29+
30+
### test_lwt_operations.py (Unit - Original)
31+
1. **test_insert_if_not_exists_success** - Unit test for successful INSERT IF NOT EXISTS
32+
2. **test_insert_if_not_exists_conflict** - Unit test for INSERT IF NOT EXISTS conflict
33+
3. **test_update_if_condition_success** - Unit test for successful conditional UPDATE
34+
4. **test_update_if_condition_failure** - Unit test for failed conditional UPDATE
35+
5. **test_delete_if_exists_success** - Unit test for successful DELETE IF EXISTS
36+
6. **test_delete_if_exists_not_found** - Unit test for DELETE IF EXISTS not found
37+
7. **test_lwt_with_multiple_conditions** - Unit test for LWT with multiple IF conditions
38+
8. **test_lwt_timeout_handling** - Unit test for LWT timeout scenarios
39+
9. **test_concurrent_lwt_operations** - Unit test for concurrent LWT operations
40+
10. **test_lwt_with_prepared_statements** - Unit test for LWT with prepared statements
41+
11. **test_lwt_batch_not_supported** - Unit test for LWT in batch (should fail)
42+
12. **test_lwt_result_parsing** - Unit test for parsing LWT result formats
43+
44+
### test_batch_and_lwt_operations.py (Consolidated)
45+
46+
#### TestBatchOperations class:
47+
1. **test_logged_batch** ✓ DUPLICATE of test_batch_operations.py
48+
2. **test_unlogged_batch** ✓ DUPLICATE of test_batch_operations.py
49+
3. **test_counter_batch** ✓ DUPLICATE of test_batch_operations.py (includes concurrent part)
50+
4. **test_batch_with_consistency_levels** ✓ DUPLICATE of test_batch_operations.py
51+
5. **test_batch_with_custom_timestamp** ✓ DUPLICATE of test_batch_operations.py
52+
6. **test_large_batch_warning** ✓ DUPLICATE of test_batch_operations.py
53+
7. **test_mixed_batch_types_error** ✓ DUPLICATE of test_batch_operations.py
54+
55+
#### TestLWTOperations class:
56+
1. **test_insert_if_not_exists** ✓ DUPLICATE (combines success/conflict from integration)
57+
2. **test_update_if_condition** ✓ DUPLICATE (combines match/no match from integration)
58+
3. **test_delete_if_exists** ✓ DUPLICATE (combines success/not found from integration)
59+
4. **test_concurrent_lwt_operations** ✓ DUPLICATE of test_lwt_operations.py integration
60+
5. **test_optimistic_locking_pattern** ✓ DUPLICATE of test_lwt_operations.py integration
61+
6. **test_lwt_timeout_handling** ✓ DUPLICATE of test_lwt_operations.py integration
62+
63+
#### TestAtomicPatterns class:
64+
1. **test_lwt_not_supported_in_batch** ✓ DUPLICATE of unit test_lwt_batch_not_supported
65+
2. **test_read_before_write_pattern** - NEW test (not in originals)
66+
67+
## Duplicates to Remove
68+
69+
### From test_batch_operations.py - ALL tests are duplicated:
70+
- test_logged_batch
71+
- test_unlogged_batch
72+
- test_counter_batch
73+
- test_mixed_batch_types_error
74+
- test_batch_with_prepared_statements (merged into test_logged_batch)
75+
- test_batch_consistency_levels
76+
- test_large_batch_warning
77+
- test_conditional_batch (concept merged into LWT tests)
78+
- test_counter_batch_concurrent (merged into test_counter_batch)
79+
- test_batch_with_custom_timestamp
80+
81+
### From test_lwt_operations.py (Integration) - ALL tests are duplicated:
82+
- test_insert_if_not_exists_success (merged into test_insert_if_not_exists)
83+
- test_insert_if_not_exists_conflict (merged into test_insert_if_not_exists)
84+
- test_update_if_condition_match (merged into test_update_if_condition)
85+
- test_update_if_condition_no_match (merged into test_update_if_condition)
86+
- test_delete_if_exists_success (merged into test_delete_if_exists)
87+
- test_delete_if_exists_not_found (merged into test_delete_if_exists)
88+
- test_concurrent_inserts_if_not_exists (renamed to test_concurrent_lwt_operations)
89+
- test_optimistic_locking_pattern
90+
- test_complex_condition_with_multiple_columns (concept merged into test_update_if_condition)
91+
- test_prepared_statements_with_lwt (concept integrated throughout)
92+
- test_lwt_error_handling (replaced by test_lwt_timeout_handling)
93+
94+
### From test_lwt_operations.py (Unit) - Keep unit tests as they test the wrapper logic:
95+
The unit tests serve a different purpose (testing the AsyncCassandraSession wrapper) and should be kept.
96+
97+
## Recommendation
98+
99+
1. **DELETE** test_batch_operations.py - All functionality is covered in consolidated file
100+
2. **DELETE** tests/integration/test_lwt_operations.py - All functionality is covered in consolidated file
101+
3. **KEEP** tests/unit/test_lwt_operations.py - Unit tests serve different purpose (wrapper logic)
102+
103+
The consolidated file provides better organization, more comprehensive testing, and includes additional patterns like test_read_before_write_pattern.

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ ignore_missing_imports = true
176176
module = "prometheus_client"
177177
ignore_missing_imports = true
178178

179+
[[tool.mypy.overrides]]
180+
module = "tests.*"
181+
disallow_untyped_defs = false
182+
disallow_incomplete_defs = false
183+
disallow_untyped_decorators = false
184+
185+
[[tool.mypy.overrides]]
186+
module = "test_utils"
187+
ignore_missing_imports = true
188+
179189
[tool.setuptools_scm]
180190
# Use git tags for versioning
181191
# This will create versions like:

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ select = [
88
"E", # pycodestyle errors
99
"F", # pyflakes
1010
"W", # pycodestyle warnings
11-
"I", # isort
11+
# "I", # isort - disabled to avoid conflicts with isort pre-commit hook
1212
"N", # pep8-naming
1313
]
1414

0 commit comments

Comments
 (0)