Recently, when running Alternator tests we get hundreds of warnings like
the following from basically all test files:
/usr/lib/python3.12/site-packages/botocore/crt/auth.py:59:
DeprecationWarning: datetime.datetime.utcnow() is deprecated and
scheduled for removal in a future version. Use timezone-aware objects
to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
/usr/local/lib/python3.12/site-packages/pytest_elk_reporter.py:299:
DeprecationWarning: datetime.datetime.utcnow() is deprecated and
scheduled for removal in a future version. Use timezone-aware objects
to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
These warnings all come from two libraries that we use in the tests -
botocore is used by Alternator tests, and elk reporter is a plugin that
we don't actually use, but it is installed by dtest and we often see
it in our runs as well. These warnings have zero interest to us - not
only do we not care if botocore uses some deprecated Python APIs and
will need to be updated in the future, all these warnings are hiding
*real* warnings about deprecated things we actually use in our own
test code.
The patch modifies test/pytest.ini (used by all our Python tests,
including but not limited to Alternator tests) to ignore deprecation
warnings from *inside* these two libraries, botocore and elk_reporter.
After this patch, test/alternator/run finishes without any warnings
at all. test/cqlpy does still have a few warnings left, which earlier
were hidden by the thousands of spammy warning eliminated in this patch.
We fix one of these warnings in this patch:
ResultSet indexing support will be removed in 4.0.
Consider using ResultSet.one()
by doing exactly what the warning recommended.
Some deprecation warnings in test/cqlpy remain in calls to
get_query_trace(). The "blame" for these warning is misplaced - this
function is part of the cassandra driver, but Python seems to think it's
part of our test code so I can't avoid them with the pytest.ini trick,
I'm not sure why. So I don't know yet how to eliminate these last warnings.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Closes scylladb/scylladb#22881
36 lines
1.5 KiB
INI
36 lines
1.5 KiB
INI
[pytest]
|
|
asyncio_mode = auto
|
|
|
|
log_format = %(asctime)s.%(msecs)03d %(levelname)s> %(message)s
|
|
log_date_format = %H:%M:%S
|
|
|
|
markers =
|
|
slow: tests that take more than 30 seconds to run
|
|
replication_factor: replication factor for RandomTables
|
|
without_scylla: run without attaching to a scylla process
|
|
enable_tablets: create keyspace with tablets enabled or disabled
|
|
repair: tests for repair
|
|
cpp: marker for c++ tests
|
|
norecursedirs = manual perf lib
|
|
# Ignore warnings about HTTPS requests without certificate verification
|
|
# (see issue #15287). Pytest breaks urllib3.disable_warnings() in conftest.py,
|
|
# so we need to do this here.
|
|
#
|
|
# Ignore warning of
|
|
# PytestWarning: record_property is incompatible with junit_family 'xunit2' (use 'legacy' or 'xunit1')
|
|
# Because `record_property` adds <properties> inside <testcase>, which is not allowed
|
|
# as per the latest xunit2 schema. see
|
|
# https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsdtestcase,
|
|
# an alternative is `record_testsuite_property`, but we want to attach test
|
|
# log on a per-test basis. so let's continue using this feature before
|
|
# switching to xunit1 or legacy.
|
|
filterwarnings =
|
|
ignore::urllib3.exceptions.InsecureRequestWarning
|
|
ignore:record_property is incompatible with junit_family:pytest.PytestWarning
|
|
ignore::DeprecationWarning:importlib._bootstrap
|
|
ignore::DeprecationWarning:botocore
|
|
ignore::DeprecationWarning:pytest_elk_reporter
|
|
|
|
tmp_path_retention_count = 1
|
|
tmp_path_retention_policy = failed
|