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

Silence warnings display by python unit tests #3161

Merged
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
10 changes: 8 additions & 2 deletions exec-tests
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ if [[ "${subtst:-python}" == "python" ]]; then

printf -- "\n\n\nRunning %s python3-based unit tests via pytest\n\n" "${major_list// /,}"
_pbench_sources=$(python3 -c 'import inspect, pathlib, pbench; print(pathlib.Path(inspect.getsourcefile(pbench)).parent)')
PYTHONUNBUFFERED=True _PBENCH_COV_DIR="${_toxenvdir}/cov" ${_ECHO} _time pytest \
# We use SQLALCHEMY_SILENCE_UBER_WARNING here to silence very prolific
# warnings posted by SQLAlchemy 1.4.x about features / behaviors being
# used which are not compatible with SQLAlchemy 2.x. Since we are not
# going to switch to 2.x any time soon, we use the big hammer approach
# to avoid the noise.
SQLALCHEMY_SILENCE_UBER_WARNING=1 PYTHONUNBUFFERED=True _PBENCH_COV_DIR="${_toxenvdir}/cov" ${_ECHO} _time pytest \
webbnh marked this conversation as resolved.
Show resolved Hide resolved
--tb=native \
${pytest_jobs_arg} \
--basetemp="${_toxenvdir}/tmp" \
Expand Down Expand Up @@ -226,7 +231,8 @@ if [[ "${major}" == "all" || "${major}" == "server" ]]; then
server_arg=${1}
shift
posargs="${@}"
PYTHONUNBUFFERED=True PBENCH_SERVER=${server_arg} pytest --tb=native -v -s ${posargs} --pyargs pbench.test.functional.server
# We use SQLALCHEMY_SILENCE_UBER_WARNING here ... (see above).
SQLALCHEMY_SILENCE_UBER_WARNING=1 PYTHONUNBUFFERED=True PBENCH_SERVER=${server_arg} pytest --tb=native -v -s ${posargs} --pyargs pbench.test.functional.server
rc=${?}
fi
fi
Expand Down
3 changes: 1 addition & 2 deletions lib/pbench/server/database/database.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sys

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.orm import declarative_base, scoped_session, sessionmaker

from pbench.server import NoOptionError, NoSectionError

Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
addopts = -s
log_cli=False
log_level=DEBUG
filterwarnings=
# Issue #557 in `pytest-cov` (currently v4.x) has not moved for a while now,
# but once a resolution has been adopted we can drop this "ignore".
# Ref: https://github.com/pytest-dev/pytest-cov/issues/557
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning