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

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new bca1834  Ninja fix all occurences of non-existent self.fail to 
pytest.fail
bca1834 is described below

commit bca1834dc7075ced5ebaeda15afcf691bcd30ab1
Author: Brandon Williams <[email protected]>
AuthorDate: Thu Jun 24 16:44:08 2021 -0500

    Ninja fix all occurences of non-existent self.fail to pytest.fail
---
 auth_test.py                                       | 8 ++++----
 cdc_test.py                                        | 2 +-
 cfid_test.py                                       | 3 ++-
 compaction_test.py                                 | 2 +-
 cqlsh_tests/test_cqlsh.py                          | 2 +-
 materialized_views_test.py                         | 6 +++---
 mixed_version_test.py                              | 6 +++---
 native_transport_ssl_test.py                       | 4 ++--
 nodetool_test.py                                   | 2 +-
 paging_test.py                                     | 4 ++--
 pushed_notifications_test.py                       | 4 ++--
 secondary_indexes_test.py                          | 6 +++---
 ttl_test.py                                        | 2 +-
 upgrade_tests/cql_tests.py                         | 2 +-
 upgrade_tests/drop_compact_storage_upgrade_test.py | 2 +-
 upgrade_tests/upgrade_through_versions_test.py     | 2 +-
 16 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/auth_test.py b/auth_test.py
index 6d92ff5..df57fb0 100644
--- a/auth_test.py
+++ b/auth_test.py
@@ -845,7 +845,7 @@ class TestAuth(Tester):
         def check_caching(attempt=0):
             attempt += 1
             if attempt > 3:
-                self.fail("Unable to verify cache expiry in 3 attempts, 
failing")
+                pytest.fail("Unable to verify cache expiry in 3 attempts, 
failing")
 
             logger.debug("Attempting to verify cache expiry, attempt 
#{i}".format(i=attempt))
             # grant SELECT to cathy
@@ -866,7 +866,7 @@ class TestAuth(Tester):
                         check_caching(attempt)
                     else:
                         # legit failure
-                        self.fail("Expecting query to raise an exception, but 
nothing was raised.")
+                        pytest.fail("Expecting query to raise an exception, 
but nothing was raised.")
                 except Unauthorized as e:
                     assert re.search("User cathy has no SELECT permission on 
<table ks.cf> or any of its parents", str(e))
 
@@ -2742,7 +2742,7 @@ class TestAuthUnavailable(Tester):
 
         try:
             self.patient_exclusive_cql_connection(node0, timeout=2, 
user='cassandra', password='cassandra')
-            self.fail("Expected login attempt to raise an exception.")
+            pytest.fail("Expected login attempt to raise an exception.")
         except NoHostAvailable as e:
             # From driver
             assert isinstance(list(e.errors.values())[0], AuthenticationFailed)
@@ -2781,7 +2781,7 @@ class TestAuthUnavailable(Tester):
 
         try:
             self.patient_exclusive_cql_connection(node0, timeout=2, 
user='cassandra', password='cassandra')
-            self.fail("Expected login attempt to raise an exception.")
+            pytest.fail("Expected login attempt to raise an exception.")
         except NoHostAvailable as e:
             # From driver
             assert isinstance(list(e.errors.values())[0], AuthenticationFailed)
diff --git a/cdc_test.py b/cdc_test.py
index 1dbe1fc..79166a9 100644
--- a/cdc_test.py
+++ b/cdc_test.py
@@ -530,7 +530,7 @@ class TestCDC(Tester):
         print('Set Two:')
         for idx_two in rd_two:
             print('   {},{},{},{}'.format(idx_two.name, idx_two.completed, 
idx_two.offset, idx_two.log_name))
-        self.fail(msg)
+        pytest.fail(msg)
 
     def _init_new_loading_node(self, ks_name, create_stmt, use_thrift=False):
         loading_node = Node(
diff --git a/cfid_test.py b/cfid_test.py
index 3ad53e8..ec0a6d6 100644
--- a/cfid_test.py
+++ b/cfid_test.py
@@ -1,5 +1,6 @@
 import os
 import logging
+import pytest
 
 from dtest import Tester, create_ks, create_cf
 
@@ -31,7 +32,7 @@ class TestCFID(Tester):
         try:
             cfs = os.listdir(node1.get_path() + "/data0/ks")
         except OSError:
-            self.fail("Path to sstables not valid.")
+            pytest.fail("Path to sstables not valid.")
 
         # check that there are 5 unique directories
         assert len(cfs) == 5
diff --git a/compaction_test.py b/compaction_test.py
index d84b5dc..55fa016 100644
--- a/compaction_test.py
+++ b/compaction_test.py
@@ -189,7 +189,7 @@ class TestCompaction(Tester):
                     assert not "Data" in afile, afile
 
         except OSError:
-            self.fail("Path to sstables not valid.")
+            pytest.fail("Path to sstables not valid.")
 
     @pytest.mark.parametrize("strategy", ['DateTieredCompactionStrategy'])
     def test_dtcs_deletion(self, strategy):
diff --git a/cqlsh_tests/test_cqlsh.py b/cqlsh_tests/test_cqlsh.py
index 78bde3a..2e1a659 100644
--- a/cqlsh_tests/test_cqlsh.py
+++ b/cqlsh_tests/test_cqlsh.py
@@ -2532,7 +2532,7 @@ class TestCqlLogin(Tester, CqlshMixin):
             if expected_error in err_line:
                 break
         else:
-            self.fail("Did not find expected error '{}' in "
+            pytest.fail("Did not find expected error '{}' in "
                       "cqlsh stderr output: {}".format(expected_error,
                                                        '\n'.join(err_lines)))
 
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 5bd0d5f..fe2fb91 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -149,7 +149,7 @@ class TestMaterializedViews(Tester):
 
             elapsed = (time.time() - start) / 60
             if elapsed > wait_minutes:
-                self.fail("The MV build hasn't started in 2 minutes.")
+                pytest.fail("The MV build hasn't started in 2 minutes.")
 
     def _insert_data(self, session):
         # insert data
@@ -1859,10 +1859,10 @@ class TestMaterializedViews(Tester):
                 if expect_digest:
                     break
                 else:
-                    self.fail("Encountered digest mismatch when we shouldn't")
+                    pytest.fail("Encountered digest mismatch when we 
shouldn't")
         else:
             if expect_digest:
-                self.fail("Didn't find digest mismatch")
+                pytest.fail("Didn't find digest mismatch")
 
     def test_simple_repair_by_base(self):
         self._simple_repair_test(repair_base=True)
diff --git a/mixed_version_test.py b/mixed_version_test.py
index 6fc656a..c619e56 100644
--- a/mixed_version_test.py
+++ b/mixed_version_test.py
@@ -55,7 +55,7 @@ class TestSchemaChanges(Tester):
 
         try:
             session.execute(SimpleStatement("SELECT * FROM test_upgrades.foo", 
consistency_level=ConsistencyLevel.ALL))
-            self.fail("expected failure")
+            pytest.fail("expected failure")
         except (ReadTimeout, OperationTimedOut):
             logger.debug("Checking node2 for warning in log")
             node2.watch_log_for(pattern, timeout=10)
@@ -64,7 +64,7 @@ class TestSchemaChanges(Tester):
         try:
             session.execute(SimpleStatement("SELECT * FROM test_upgrades.foo", 
consistency_level=ConsistencyLevel.ALL,
                                             fetch_size=None))
-            self.fail("expected failure")
+            pytest.fail("expected failure")
         except (ReadTimeout, OperationTimedOut):
             logger.debug("Checking node2 for warning in log")
             pattern = r".*Got .* command for nonexistent table 
test_upgrades.foo.*"
@@ -75,7 +75,7 @@ class TestSchemaChanges(Tester):
             for i in range(20):
                 session.execute(SimpleStatement("SELECT * FROM 
test_upgrades.foo WHERE a = %d" % (i,),
                                                 
consistency_level=ConsistencyLevel.ALL, fetch_size=None))
-            self.fail("expected failure")
+            pytest.fail("expected failure")
         except (ReadTimeout, OperationTimedOut):
             logger.debug("Checking node2 for warning in log")
             pattern = r".*Got .* command for nonexistent table 
test_upgrades.foo.*"
diff --git a/native_transport_ssl_test.py b/native_transport_ssl_test.py
index 4d49103..7af446a 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)
-            self.fail('Should not be able to connect to SSL socket without SSL 
enabled client')
+            pytest.fail('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)
-            self.fail('Should not be able to connect to non-default port')
+            pytest.fail('Should not be able to connect to non-default port')
         except NoHostAvailable:
             pass
 
diff --git a/nodetool_test.py b/nodetool_test.py
index 800181c..6ca0381 100644
--- a/nodetool_test.py
+++ b/nodetool_test.py
@@ -347,7 +347,7 @@ class TestNodetool(Tester):
             assert 'concurrent_view_builders should be great than 0.' in 
e.stdout
             assert 'Number of concurrent view builders should be greater than 
0.', e.message
         else:
-            self.fail("Expected error when setting and invalid value")
+            pytest.fail("Expected error when setting and invalid value")
 
     @since('4.0')
     def test_describecluster_more_information_three_datacenters(self):
diff --git a/paging_test.py b/paging_test.py
index 6983d3f..971c777 100644
--- a/paging_test.py
+++ b/paging_test.py
@@ -365,7 +365,7 @@ class TestPagingWithModifiers(BasePagingTester, 
PageAssertionMixin):
                 )
             else:
                 # this should not happen
-                self.fail("Invalid scenario configuration. Scenario is: 
{}".format(scenario))
+                pytest.fail("Invalid scenario configuration. Scenario is: 
{}".format(scenario))
 
             pf = PageFetcher(future).request_all()
             assert pf.num_results_all() == scenario['expect_pgsizes']
@@ -3450,7 +3450,7 @@ class TestPagingWithDeletions(BasePagingTester, 
PageAssertionMixin):
         except Exception:
             raise
         else:
-            self.fail('Expected ReadFailure or ReadTimeout, depending on the 
cluster version')
+            pytest.fail('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 a3b1bdc..9d0ab93 100644
--- a/pushed_notifications_test.py
+++ b/pushed_notifications_test.py
@@ -431,7 +431,7 @@ class TestVariousNotifications(Tester):
             except Exception:
                 raise
             else:
-                self.fail('Expected ReadFailure')
+                pytest.fail('Expected ReadFailure')
 
         read_failure_query()
 
@@ -463,7 +463,7 @@ class TestVariousNotifications(Tester):
             except Exception:
                 raise
             else:
-                self.fail('Expected ReadFailure')
+                pytest.fail('Expected ReadFailure')
 
         range_request_failure_query()
 
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index d32f9e3..5d73b0e 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -109,7 +109,7 @@ class TestSecondaryIndexes(Tester):
                     assert expected_per_range > 0
                     break
             else:
-                self.fail("Didn't find matching trace event")
+                pytest.fail("Didn't find matching trace event")
 
         query = SimpleStatement("SELECT * FROM ks.cf WHERE b='1';")
         result = session.execute(query, trace=True)
@@ -283,7 +283,7 @@ class TestSecondaryIndexes(Tester):
     def _execute_and_fail(self, operation, cql_string):
         try:
             operation()
-            self.fail("Expecting query {} to be invalid".format(cql_string))
+            pytest.fail("Expecting query {} to be invalid".format(cql_string))
         except AssertionError as e:
             raise e
         except InvalidRequest:
@@ -567,7 +567,7 @@ class TestSecondaryIndexes(Tester):
                     on_failure(trace, regex, expected_matches, match_counts, 
event_source, min_matches, max_matches)
 
         def halt_on_failure(trace, regex, expected_matches, match_counts, 
event_source, min_expected, max_expected):
-            self.fail("Expected to find between {min} and {max} trace events 
matching {pattern} from {source}, "
+            pytest.fail("Expected to find between {min} and {max} trace events 
matching {pattern} from {source}, "
                       "but actually found {actual}. (Full counts: {all})"
                       .format(min=min_expected, max=max_expected, 
pattern=regex, source=event_source,
                               actual=match_counts[event_source], 
all=match_counts))
diff --git a/ttl_test.py b/ttl_test.py
index e0168ab..7ebebae 100644
--- a/ttl_test.py
+++ b/ttl_test.py
@@ -385,7 +385,7 @@ class TestTTL(Tester):
             result = self.session1.execute_async(query + ";")
             result.result()
             if policy == 'REJECT':
-                self.fail("should throw InvalidRequest")
+                pytest.fail("should throw InvalidRequest")
             if self.cluster.version() >= '3.0':  # client warn only on 3.0+
                 if policy == 'CAP':
                     logger.debug("Warning is {}", result.warnings[0])
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index e6a3b97..1bb979e 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -5083,7 +5083,7 @@ class TestCQL(UpgradeTester):
             # since the protocol requires strings to be valid UTF-8, the error 
response to this is a ProtocolError
             try:
                 cursor.execute("insert into ks.invalid_string_literals (k, b) 
VALUES (0, '\xc2\x01')")
-                self.fail("Expected error")
+                pytest.fail("Expected error")
             except ProtocolException as e:
                 assert "Cannot decode string as UTF8" in str(e)
 
diff --git a/upgrade_tests/drop_compact_storage_upgrade_test.py 
b/upgrade_tests/drop_compact_storage_upgrade_test.py
index d242de1..99be6ef 100644
--- a/upgrade_tests/drop_compact_storage_upgrade_test.py
+++ b/upgrade_tests/drop_compact_storage_upgrade_test.py
@@ -40,7 +40,7 @@ class TestDropCompactStorage(Tester):
     def drop_compact_storage(self, session, assert_msg):
         try:
             session.execute("ALTER TABLE drop_compact_storage_test.test DROP 
COMPACT STORAGE")
-            self.fail("No exception has been thrown")
+            pytest.fail("No exception has been thrown")
         except InvalidRequest as e:
             assert assert_msg in str(e)
 
diff --git a/upgrade_tests/upgrade_through_versions_test.py 
b/upgrade_tests/upgrade_through_versions_test.py
index a8e6087..df6680b 100644
--- a/upgrade_tests/upgrade_through_versions_test.py
+++ b/upgrade_tests/upgrade_through_versions_test.py
@@ -720,7 +720,7 @@ class TestUpgrade(Tester):
             actual_num_rows = result[0][0]
             assert actual_num_rows == expected_num_rows, "SELECT COUNT(*) 
returned %s when expecting %s" % (actual_num_rows, expected_num_rows)
         else:
-            self.fail("Count query did not return")
+            pytest.fail("Count query did not return")
 
 class BootstrapMixin(object):
     """

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

Reply via email to