CI fails now when unit tests for backend fail (#536)

* CI fails now when unit tests for backend fail

* Fixing up a couple unit tests
This commit is contained in:
Cole Medin 2025-08-30 11:52:34 -06:00 committed by GitHub
parent 811d0a7f31
commit 763e5b8244
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 9 deletions

View File

@ -122,7 +122,7 @@ jobs:
uv run pytest tests/ --verbose --tb=short \ uv run pytest tests/ --verbose --tb=short \
--cov=src --cov-report=xml --cov-report=html \ --cov=src --cov-report=xml --cov-report=html \
--cov-report=term-missing \ --cov-report=term-missing \
--junitxml=test-results.xml || true --junitxml=test-results.xml
- name: Upload backend test results - name: Upload backend test results
if: always() if: always()

View File

@ -27,7 +27,7 @@ help:
install: install:
@echo "Installing dependencies..." @echo "Installing dependencies..."
@cd archon-ui-main && npm install @cd archon-ui-main && npm install
@cd python && uv sync @cd python && uv sync --group all --group dev
@echo "✓ Dependencies installed" @echo "✓ Dependencies installed"
# Check environment # Check environment

View File

@ -146,7 +146,7 @@ class TestAsyncBackgroundTaskManager:
assert len(running_tasks) <= 2 assert len(running_tasks) <= 2
# Wait for all to complete # Wait for all to complete
await asyncio.sleep(0.1) await asyncio.sleep(0.3)
assert len(completed_tasks) == 4 assert len(completed_tasks) == 4
# Clean up # Clean up

View File

@ -69,20 +69,22 @@ class TestSourceIDGeneration:
assert ids[0] == ids[4], "First and last ID should match" assert ids[0] == ids[4], "First and last ID should match"
def test_url_normalization(self): def test_url_normalization(self):
"""Test that URL normalization works correctly.""" """Test that URL variations generate consistent IDs based on case differences."""
handler = URLHandler() handler = URLHandler()
# These should all generate the same ID (after normalization) # Test that URLs with same case generate same ID, different case generates different ID
url_variations = [ url_variations = [
"https://github.com/Microsoft/TypeScript", "https://github.com/Microsoft/TypeScript",
"HTTPS://GITHUB.COM/MICROSOFT/TYPESCRIPT", "https://github.com/microsoft/typescript", # Different case in path
"https://GitHub.com/Microsoft/TypeScript", "https://GitHub.com/Microsoft/TypeScript", # Different case in domain
] ]
ids = [handler.generate_unique_source_id(url) for url in url_variations] ids = [handler.generate_unique_source_id(url) for url in url_variations]
# All normalized versions should generate the same ID # First and third should be same (only domain case differs, which gets normalized)
assert len(set(ids)) == 1, f"Normalized URLs should generate same ID, got: {set(ids)}" # Second should be different (path case matters)
assert ids[0] == ids[2], f"URLs with only domain case differences should generate same ID"
assert ids[0] != ids[1], f"URLs with path case differences should generate different IDs"
def test_concurrent_crawl_simulation(self): def test_concurrent_crawl_simulation(self):
"""Simulate concurrent crawls to verify no race conditions.""" """Simulate concurrent crawls to verify no race conditions."""