Remove handling of sqlalchemy during tests

Now, tests pass without this handling.

[skip changelog]
This commit is contained in:
Roman Inflianskas 2024-07-16 22:44:38 +03:00
parent 3da812157f
commit f21338900b
No known key found for this signature in database

View file

@ -450,28 +450,17 @@ defined_toxenvs=$(echo "%toxenvs_excluded" "%toxenvs" | xargs -n1 | sort -u)
tox_ini_toxenvs=$(cat tox.ini | sed -r -n 's/[[:blank:]]*(.*):[[:blank:]]*TESTPATH=.*/%{default_toxenv}-\1/p' | xargs -n1 | sort -u)
diff <(echo "$defined_toxenvs") <(echo "$tox_ini_toxenvs")
# TODO:
# sqlalchemy installed during tests causes many failures.
# It is used by sentry_sdk/db/explain_plan/sqlalchemy.py and is optional, drop it.
# Test sqlalchemy separately.
%tox -e %{default_toxenv}-sqlalchemy -- -- ${deselect-} ${ignore-}
# Make `import sqlalchemy` fail
echo "raise ImportError()" > sqlalchemy.py
# Start redis-server, which is required for some integration tests.
%{_bindir}/redis-server --bind 127.0.0.1 --port 6379 &
REDIS_SERVER_PID=$!
%define toxenvs_csv_without_sqlalchemy %{expand:%(echo %{toxenvs_csv} | sed "s/%{default_toxenv}-sqlalchemy,//")}
# TODO:
# By some reason, some tests fail because of django plugin, run them separately.
%define toxenvs_csv_without_django_and_sqlalchemy %{expand:%(echo %{toxenvs_csv} | sed "s/%{default_toxenv}-django,//")}
%define toxenvs_csv_without_django %{expand:%(echo %{toxenvs_csv} | sed "s/%{default_toxenv}-django,//")}
tests_no_django="test_link_trace_context_to_error_event or test_on_end_sentry_span or test_on_end_sentry_transaction or test_pruning_old_spans_on_end or test_transaction_style or test_user_information_error or test_circular_references"
%tox -e %{toxenvs_csv_without_django_and_sqlalchemy} -- -- -p no:django ${deselect-} ${ignore-} tests/integrations/opentelemetry tests/integrations/starlette/test_starlette.py tests/integrations/threading/test_threading.py -k "$tests_no_django"
%tox -e %{toxenvs_csv_without_django} -- -- -p no:django ${deselect-} ${ignore-} tests/integrations/opentelemetry tests/integrations/starlette/test_starlette.py tests/integrations/threading/test_threading.py -k "$tests_no_django"
%tox -e %{toxenvs_csv_without_sqlalchemy} -- -- ${deselect-} ${ignore-} -k "not ($tests_no_django)"
%tox -e %{toxenvs_csv} -- -- ${deselect-} ${ignore-} -k "not ($tests_no_django)"
# Terminate redis-server.
%{_bindir}/redis-cli shutdown nosave force now