mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-18 14:08:04 +00:00
Fix CI pipeline: Add missing dependencies for performance tests
- Add Pillow, prettytable, and pyLibravatar to performance test jobs - Make performance_tests.py work without Django dependencies - Add local implementations of generate_random_email and random_string - Fix ModuleNotFoundError: No module named 'PIL' in CI environment - Fix flake8 redefinition warning This resolves the pipeline failure in performance_tests_dev job.
This commit is contained in:
@@ -11,18 +11,39 @@ import sys
|
||||
import time
|
||||
import statistics
|
||||
import hashlib
|
||||
import random
|
||||
import string
|
||||
from typing import Dict, List, Any, Optional, Tuple
|
||||
|
||||
# Add project root to path
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
# Import utilities
|
||||
from ivatar.utils import generate_random_email
|
||||
from libravatar import libravatar_url
|
||||
from urllib.parse import urlsplit
|
||||
from prettytable import PrettyTable
|
||||
|
||||
|
||||
def random_string(length=10):
|
||||
"""Return some random string with default length 10"""
|
||||
return "".join(
|
||||
random.SystemRandom().choice(string.ascii_lowercase + string.digits)
|
||||
for _ in range(length)
|
||||
)
|
||||
|
||||
|
||||
# Try to import Django utilities for local testing, fallback to local implementation
|
||||
try:
|
||||
from ivatar.utils import generate_random_email
|
||||
except ImportError:
|
||||
# Use local version for external testing
|
||||
def generate_random_email():
|
||||
"""Generate a random email address using the same pattern as test_views.py"""
|
||||
username = random_string()
|
||||
domain = random_string()
|
||||
tld = random_string(2)
|
||||
return f"{username}@{domain}.{tld}"
|
||||
|
||||
|
||||
# Django setup - only for local testing
|
||||
def setup_django() -> None:
|
||||
"""Setup Django for local testing"""
|
||||
|
||||
Reference in New Issue
Block a user