Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): revert to dedicated user in blurring performance evaluation #3388

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .utils import activate_profiling_sql

from .benchmark_generator import BenchmarkTest, CLater
from geonature.tests.fixtures import users


logging.basicConfig()
Expand Down Expand Up @@ -105,4 +106,4 @@ class TestBenchmarkSynthese:
),
)

add_bluring_to_benchmark_test_class(TestBenchmarkSynthese)
add_bluring_to_benchmark_test_class(TestBenchmarkSynthese, "user_with_blurring")
5 changes: 4 additions & 1 deletion backend/geonature/tests/benchmarks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from geonature.tests.test_synthese import blur_sensitive_observations
import traceback
from geonature.tests.fixtures import app
from pypnusershub.db.models import User

logging.basicConfig()
logger = logging.getLogger("logger-name")
Expand Down Expand Up @@ -62,7 +63,7 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema
event.listen(db.engine, "after_cursor_execute", after_cursor_execute)


def add_bluring_to_benchmark_test_class(benchmark_cls: type):
def add_bluring_to_benchmark_test_class(benchmark_cls: type, different_user: str = None):
"""
Add the blurring enabling fixture to all benchmark tests declared in the given class.

Expand All @@ -86,6 +87,8 @@ def add_bluring_to_benchmark_test_class(benchmark_cls: type):
if "fixtures" in kwargs
else [blur_sensitive_observations]
)
if different_user:
kwargs["user_profile"] = different_user
# Recreate BenchmarkTest object including the blurring enabling fixture
setattr(
benchmark_cls,
Expand Down
Loading