This is an automated email from the ASF dual-hosted git repository.

jlewandowski pushed a commit to branch ds-trunk-5.0--2024-07-24
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git

commit b5cb1da62ad5ef646eba8bed86def3feee7d76b8
Author: Ekaterina Dimitrova <[email protected]>
AuthorDate: Tue Jul 16 17:37:07 2024 -0400

    CNDB-10152: Fix Python DTests calls to pytest.fail() and skip() for newer 
pytest versions. Pin lowest expected pytest version in requirements.txt
---
 bootstrap_test.py              | 4 ++--
 compaction_test.py             | 8 ++++----
 conftest.py                    | 2 +-
 mixed_version_test.py          | 2 +-
 native_transport_ssl_test.py   | 4 ++--
 offline_tools_test.py          | 2 +-
 paging_test.py                 | 2 +-
 pushed_notifications_test.py   | 4 ++--
 rebuild_test.py                | 2 +-
 replica_side_filtering_test.py | 4 ++--
 requirements.txt               | 2 +-
 upgrade_tests/cql_tests.py     | 6 +++---
 upgrade_tests/paging_test.py   | 2 +-
 upgrade_tests/upgrade_base.py  | 2 +-
 14 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/bootstrap_test.py b/bootstrap_test.py
index 9504e556..5b4e4882 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -1034,7 +1034,7 @@ class BootstrapTester(Tester):
 
         try:
             node2.nodetool('join')
-            pytest.fail('nodetool should have errored and failed to join ring')
+            pytest.fail(reason='nodetool should have errored and failed to 
join ring')
         except ToolError as t:
             assert "Cannot join the ring until bootstrap completes" in t.stdout
 
@@ -1059,7 +1059,7 @@ class BootstrapTester(Tester):
 
         try:
             node3.nodetool('join')
-            pytest.fail('nodetool should have errored and failed to join ring')
+            pytest.fail(reason='nodetool should have errored and failed to 
join ring')
         except ToolError as t:
             assert "Cannot join the ring until bootstrap completes" in t.stdout
 
diff --git a/compaction_test.py b/compaction_test.py
index d79f1326..a4e93eab 100644
--- a/compaction_test.py
+++ b/compaction_test.py
@@ -218,7 +218,7 @@ class TestCompaction(Tester):
         self.skip_if_not_supported(strategy)
 
         if strategy != 'DateTieredCompactionStrategy':
-            pytest.skip('Not implemented unless DateTieredCompactionStrategy 
is used')
+            pytest.skip(reason='Not implemented unless 
DateTieredCompactionStrategy is used')
 
         cluster = self.cluster
         cluster.populate(1).start()
@@ -561,7 +561,7 @@ class TestCompaction(Tester):
         @jira_ticket CASSANDRA-11550
         """
         if not hasattr(self, 'strategy') or strategy != 
'LeveledCompactionStrategy':
-            pytest.skip('Not implemented unless LeveledCompactionStrategy is 
used')
+            pytest.skip(reason='Not implemented unless 
LeveledCompactionStrategy is used')
 
         cluster = self.cluster
         cluster.populate(1).start()
@@ -605,11 +605,11 @@ class TestCompaction(Tester):
 
     def skip_if_no_major_compaction(self, strategy):
         if self.cluster.version() < '2.2' and strategy == 
'LeveledCompactionStrategy':
-            pytest.skip('major compaction not implemented for LCS in this 
version of Cassandra')
+            pytest.skip(reason='major compaction not implemented for LCS in 
this version of Cassandra')
 
     def skip_if_not_supported(self, strategy):
         if self.cluster.version() >= '5.0' and strategy == 
'DateTieredCompactionStrategy':
-            pytest.skip('DateTieredCompactionStrategy is not supported in 
Cassandra 5.0 and later')
+            pytest.skip(reason='DateTieredCompactionStrategy is not supported 
in Cassandra 5.0 and later')
 
 def grep_sstables_in_each_level(node, table_name):
     output = node.nodetool('tablestats').stdout
diff --git a/conftest.py b/conftest.py
index 785eceda..3d72c6a4 100644
--- a/conftest.py
+++ b/conftest.py
@@ -372,7 +372,7 @@ def fixture_dtest_setup(request,
             errors = check_logs_for_errors(dtest_setup)
             if len(errors) > 0:
                 failed = True
-                pytest.fail('Unexpected error found in node logs (see stdout 
for full details). Errors: [{errors}]'
+                pytest.fail(reason='Unexpected error found in node logs (see 
stdout for full details). Errors: [{errors}]'
                             .format(errors=str.join(", ", errors)), 
pytrace=False)
     finally:
         try:
diff --git a/mixed_version_test.py b/mixed_version_test.py
index e4ad313f..a30d7341 100644
--- a/mixed_version_test.py
+++ b/mixed_version_test.py
@@ -31,7 +31,7 @@ class TestSchemaChanges(Tester):
         elif original_version.vstring.startswith('2.1'):
             upgraded_version = 'github:apache/cassandra-2.2'
         else:
-            pytest.skip("This test is only designed to work with 2.0 and 2.1 
right now")
+            pytest.skip(reason="This test is only designed to work with 2.0 
and 2.1 right now")
 
         # start out with a major behind the previous version
 
diff --git a/native_transport_ssl_test.py b/native_transport_ssl_test.py
index 0046e572..ba68bc50 100644
--- a/native_transport_ssl_test.py
+++ b/native_transport_ssl_test.py
@@ -36,7 +36,7 @@ class TestNativeTransportSSL(Tester):
         try:  # hack around assertRaise's lack of msg parameter
             # try to connect without ssl options
             self.patient_cql_connection(node1)
-            pytest.fail('Should not be able to connect to SSL socket without 
SSL enabled client')
+            pytest.fail(reason='Should not be able to connect to SSL socket 
without SSL enabled client')
         except NoHostAvailable:
             pass
 
@@ -78,7 +78,7 @@ class TestNativeTransportSSL(Tester):
         cluster.start()
         try:  # hack around assertRaise's lack of msg parameter
             self.patient_cql_connection(node1)
-            pytest.fail('Should not be able to connect to non-default port')
+            pytest.fail(reason='Should not be able to connect to non-default 
port')
         except NoHostAvailable:
             pass
 
diff --git a/offline_tools_test.py b/offline_tools_test.py
index 81bbec0d..1d65349d 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -355,7 +355,7 @@ class TestOfflineTools(Tester):
             #   Error opening zip file or JAR manifest missing : 
/home/mshuler/git/cassandra/lib/jamm-0.2.5.jar
             # The 2.1 installed jamm version is 0.3.0, but bin/cassandra.in.sh 
used by nodetool still has 0.2.5
             # (when this is fixed in CCM issue #463, install 
version='github:apache/cassandra-2.0' as below)
-            pytest.skip('Skipping 2.1 test due to jamm.jar version upgrade 
problem in CCM node configuration.')
+            pytest.skip(reason='Skipping 2.1 test due to jamm.jar version 
upgrade problem in CCM node configuration.')
         elif testversion < '3.0':
             logger.debug('Test version: {} - installing 
github:apache/cassandra-2.1'.format(testversion))
             cluster.set_install_dir(version='github:apache/cassandra-2.1')
diff --git a/paging_test.py b/paging_test.py
index e6554b85..408b78ee 100644
--- a/paging_test.py
+++ b/paging_test.py
@@ -3458,7 +3458,7 @@ class TestPagingWithDeletions(BasePagingTester, 
PageAssertionMixin):
         except Exception:
             raise
         else:
-            pytest.fail('Expected ReadFailure or ReadTimeout, depending on the 
cluster version')
+            pytest.fail(reason='Expected ReadFailure or ReadTimeout, depending 
on the cluster version')
 
         if self.cluster.version() < "3.0":
             failure_msg = ("Scanned over.* tombstones in test_paging_size."
diff --git a/pushed_notifications_test.py b/pushed_notifications_test.py
index 70b42ffe..68bc6ab4 100644
--- a/pushed_notifications_test.py
+++ b/pushed_notifications_test.py
@@ -436,7 +436,7 @@ class TestVariousNotifications(Tester):
             except Exception:
                 raise
             else:
-                pytest.fail('Expected ReadFailure')
+                pytest.fail(reason='Expected ReadFailure')
 
         read_failure_query()
 
@@ -468,7 +468,7 @@ class TestVariousNotifications(Tester):
             except Exception:
                 raise
             else:
-                pytest.fail('Expected ReadFailure')
+                pytest.fail(reason='Expected ReadFailure')
 
         range_request_failure_query()
 
diff --git a/rebuild_test.py b/rebuild_test.py
index 56b1ac4a..7fa4cc99 100644
--- a/rebuild_test.py
+++ b/rebuild_test.py
@@ -232,7 +232,7 @@ class TestRebuild(Tester):
             logger.debug('Checking data is complete -> '),
             for i in range(0, 20000):
                 query_c1c2(session, i, ConsistencyLevel.LOCAL_ONE)
-            pytest.fail('Expected: INCOMPLETE')
+            pytest.fail(reason='Expected: INCOMPLETE')
 
         logger.debug('Executing second rebuild -> '),
         node3.nodetool('rebuild dc1')
diff --git a/replica_side_filtering_test.py b/replica_side_filtering_test.py
index 0a86d268..c1e4918c 100644
--- a/replica_side_filtering_test.py
+++ b/replica_side_filtering_test.py
@@ -103,11 +103,11 @@ class ReplicaSideFiltering(Tester):
 
     def _skip_if_index_on_static_is_not_supported(self):
         if self.create_index() and self.cluster.version() < '3.4':
-            pytest.skip('Secondary indexes on static column are not supported 
before 3.4 (CASSANDRA-8103)')
+            pytest.skip(reason='Secondary indexes on static column are not 
supported before 3.4 (CASSANDRA-8103)')
 
     def _skip_if_filtering_partition_columns_is_not_supported(self):
         if not self.create_index() and self.cluster.version() < '3.11':
-            pytest.skip('Filtering of partition key parts is not supported 
before 3.11 (CASSANDRA-13275)')
+            pytest.skip(reason='Filtering of partition key parts is not 
supported before 3.11 (CASSANDRA-13275)')
 
     @abstractmethod
     def create_index(self):
diff --git a/requirements.txt b/requirements.txt
index df15c7d1..9661664a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -28,7 +28,7 @@ psutil==5.9.8
 py==1.11.0
 pycodestyle==2.10.0
 pyparsing==3.1.2
-pytest==7.0.1
+pytest>=8.2.2
 pytest-repeat==0.9.1
 pytest-timeout==2.1.0
 PyYAML==6.0.1
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index e8215859..3f83584c 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -88,7 +88,7 @@ class TestCQL(UpgradeTester):
         """ For large collections, make sure that we are printing warnings """
         for version in self.get_node_versions():
             if version >= '3.0':
-                pytest.skip('version {} not compatible with protocol version 
2'.format(version))
+                pytest.skip(reason='version {} not compatible with protocol 
version 2'.format(version))
 
         # We only warn with protocol 2
         cursor = self.prepare(protocol_version=2)
@@ -1572,9 +1572,9 @@ class TestCQL(UpgradeTester):
 
             upgrade_to_version = self.get_node_version(is_upgraded=True)
             if LooseVersion('3.0.0') <= upgrade_to_version <= 
LooseVersion('3.0.6'):
-                pytest.skip('CASSANDRA-11930 was fixed in 3.0.7 and 3.7')
+                pytest.skip(reason='CASSANDRA-11930 was fixed in 3.0.7 and 
3.7')
             elif LooseVersion('3.1') <= upgrade_to_version <= 
LooseVersion('3.6'):
-                pytest.skip('CASSANDRA-11930 was fixed in 3.0.7 and 3.7')
+                pytest.skip(reason='CASSANDRA-11930 was fixed in 3.0.7 and 
3.7')
 
             session.execute("TRUNCATE ks.cf")
 
diff --git a/upgrade_tests/paging_test.py b/upgrade_tests/paging_test.py
index 8880e9b8..bf5e9277 100644
--- a/upgrade_tests/paging_test.py
+++ b/upgrade_tests/paging_test.py
@@ -660,7 +660,7 @@ class TestPagingData(BasePagingTester, PageAssertionMixin):
             min_version = min(self.get_node_versions())
             latest_version_with_bug = '2.2.3'
             if min_version <= latest_version_with_bug:
-                pytest.skip('known bug released in {latest_ver} and earlier 
(current min version {min_ver}); '
+                pytest.skip(reason='known bug released in {latest_ver} and 
earlier (current min version {min_ver}); '
                                
'skipping'.format(latest_ver=latest_version_with_bug, min_ver=min_version))
 
             logger.debug("Querying %s node" % ("upgraded" if is_upgraded else 
"old",))
diff --git a/upgrade_tests/upgrade_base.py b/upgrade_tests/upgrade_base.py
index 30f51b25..294db811 100644
--- a/upgrade_tests/upgrade_base.py
+++ b/upgrade_tests/upgrade_base.py
@@ -165,7 +165,7 @@ class UpgradeTester(Tester, metaclass=ABCMeta):
                         "max version {}".format(new_version_from_build, 
self.max_version))
 
         if (new_version_from_build >= '3' and self.protocol_version is not 
None and self.protocol_version < 3):
-            pytest.skip('Protocol version {} incompatible '
+            pytest.skip(reason='Protocol version {} incompatible '
                         'with Cassandra version 
{}'.format(self.protocol_version, new_version_from_build))
         node1.set_log_level(logging.getLevelName(logging.root.level))
         node1.set_configuration_options(values={'internode_compression': 
'none'})


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to