Skip to content
Open
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
2 changes: 1 addition & 1 deletion buildscripts/archive_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_tarball(output_filename, file_patterns, exclude_patterns):

try:
from pyzstd import ZstdFile
except:
except Exception:
pass

print(f"Creating tarball: {output_filename}")
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/bazel_burn_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_burn_in_target(target_original: str, target_burn_in: str, test: str):
# If the label is present, and buildozer fails for another reason, the build
# of the burn-in target produces a clear message that it is duplicated.
buildozer.bd_remove([target_burn_in], "data", [test_label])
except:
except Exception:
pass
buildozer.bd_set([target_burn_in], "srcs", test_label)
buildozer.bd_set([target_burn_in], "shard_count", "1")
Expand Down
4 changes: 2 additions & 2 deletions buildscripts/check_for_noexcept.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ class Alert:
identifier: str | None

def get_title(self) -> str:
if self.kind == AlertKind.Noexcept:
if self.kind == AlertKind.Noexcept Exception:
return ANNOTATION_TITLE_TEXT_NOEXCEPT_CHANGE
else:
assert self.kind == AlertKind.NonNoexceptMove
return ANNOTATION_TITLE_TEXT_NON_NOEXCEPT_MOVE

def get_message(self) -> str:
if self.kind == AlertKind.Noexcept:
if self.kind == AlertKind.Noexcept Exception:
return ANNOTATION_MESSAGE_TEXT_NOEXCEPT_CHANGE
else:
assert self.kind == AlertKind.NonNoexceptMove
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/gdb/wt_dump_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def dump_update_chain(update_chain):
if can_bson:
try:
obj = bson.decode_all(val_bytes)[0]
except:
except Exception:
pass
print(" " + "\n ".join(str(wt_val).split("\n")) + " " + str(obj) + " =>")

Expand Down
2 changes: 1 addition & 1 deletion buildscripts/idl/tests/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _parse(self, doc_str, resolver):

try:
return idl.parser.parse(doc_str, "unknown", resolver)
except:
except Exception:
self.fail("Failed to parse document:\n%s" % (doc_str))

def _assert_parse(self, doc_str, parsed_doc):
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/lldb/lldb_printers.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def update(self):
self.data_type = resolve_type_to_base(
self.valobj.GetChildMemberWithName("slots_").GetType()
).GetPointerType()
except:
except Exception:
print("Exception: " + str(sys.exc_info()))


Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/configure_resmoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def get_excluded_mongot_versions(mongot_version):
)
except (KeyboardInterrupt, SystemExit):
raise
except:
except Exception:
# We want this as a catch all exception
# If there is some problem setting up metrics we don't want resmoke to fail
# We would rather just swallow the error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def from_yaml_file(cls, yaml_file: str) -> MongoReleases:
safe_load_result = yaml.safe_load(yaml_contents)
try:
return cls(**safe_load_result)
except:
except Exception:
LOGGER.info(
"MongoReleases.from_yaml_file() failed\n"
f"yaml_file = {yaml_file}\n"
Expand Down
8 changes: 4 additions & 4 deletions buildscripts/resmokelib/powercycle/powercycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def exit_handler():
with open(REPORT_JSON_FILE, "w") as jstream:
json.dump(REPORT_JSON, jstream)
LOGGER.debug("Exit handler: report file contents %s", REPORT_JSON)
except:
except Exception:
pass

if EXIT_YML_FILE:
Expand All @@ -123,21 +123,21 @@ def exit_handler():
with open(EXIT_YML_FILE, "w") as yaml_stream:
yaml.safe_dump(EXIT_YML, yaml_stream)
LOGGER.debug("Exit handler: report file contents %s", EXIT_YML)
except:
except Exception:
pass

LOGGER.debug("Exit handler: Killing processes")
try:
Processes.kill_all()
LOGGER.debug("Exit handler: Killing processes finished")
except:
except Exception:
pass

LOGGER.debug("Exit handler: Cleaning up temporary files")
try:
NamedTempFile.delete_all()
LOGGER.debug("Exit handler: Cleaning up temporary files finished")
except:
except Exception:
pass


Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def _execute_suite(self, suite: Suite) -> bool:
}
)
return True
except:
except Exception:
self._exec_logger.exception(
"Encountered an error when running %ss of suite %s.",
suite.test_kind,
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/symbolizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _setup_symbols(self):
self.logger.info("Applying patch diff (if any)...")
self._patch_diff_by_id()

except:
except Exception:
if self.dest_dir is not None:
self.logger.warning(
"Removing downloaded directory due to error, directory to be removed: %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _get_san_options(self):
@staticmethod
def get_resmoke_run_command() -> str:
"""Construct the supported resmoke `run` command to test against an external system under test."""
# The supported `run` command should keep all of the same args except:
# The supported `run` command should keep all of the same args except Exception:
# (1) it should remove the `--dockerComposeBuildImages` option and value
# (2) it should add the `--externalSUT` flag
command = sys.argv
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/testing/hooks/background_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def run(self):

try:
self._hook_test_case.run_dynamic_test(self._test_report)
except:
except Exception:
self.exc_info = sys.exc_info()
finally:
with self._lock:
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/testing/hooks/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ def run_test(self):
self.logger.info("Starting the fixture back up again...")
self.fixture.setup()
self.fixture.await_ready()
except:
except Exception:
self.logger.exception("Encountered an error while restarting the fixture.")
raise
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run_test(self):
self.logger.info("Dropping database %s", db_name)
try:
with_naive_retry(lambda: client.drop_database(db_name))
except:
except Exception:
self.logger.exception("Encountered an error while dropping database %s.", db_name)
raise

Expand All @@ -89,7 +89,7 @@ def run_test(self):
self.logger.info("Dropping db %s collection %s", same_db_name, coll)
try:
with_naive_retry(lambda: client[same_db_name].drop_collection(coll))
except:
except Exception:
self.logger.exception(
"Encountered an error while dropping db % collection %s.",
same_db_name,
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/testing/hooks/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def run_dynamic_test(self, test_report):
self.logger.error("{0} failed".format(self.description))
test_report.addFailure(self, sys.exc_info())
raise errors.TestFailure(err.args[0])
except:
except Exception:
self.return_code = 2
test_report.addFailure(self, sys.exc_info())
raise
Expand Down
6 changes: 3 additions & 3 deletions buildscripts/resmokelib/testing/hooks/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def run_test(self):
# Perform inter-node validation (if the running fixture provides a method to run it).
if getattr(self.fixture, "internode_validation", None):
self.fixture.internode_validation()
except:
except Exception:
self.logger.exception("Uncaught exception while validating collections")
raise

Expand Down Expand Up @@ -175,7 +175,7 @@ def validate_node(
):
raise RuntimeError(f"Internal error while validating database: {db_name}")
return True
except:
except Exception:
logger.exception(
f"Unknown exception while validating node {node.get_driver_connection_url()}"
)
Expand Down Expand Up @@ -274,7 +274,7 @@ def list_collections(db: Database, filter: dict, timeout: int = 10):
)
)
return True
except:
except Exception:
logger.exception("Unknown exception while validating database")
return False

Expand Down
16 changes: 8 additions & 8 deletions buildscripts/resmokelib/testing/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def start(
"Received a StopExecution exception when setting up the fixture: %s.", err
)
setup_succeeded = False
except:
except Exception:
# Something unexpected happened when setting up the fixture. We don't attempt to run
# any tests.
self.logger.exception("Encountered an error when setting up the fixture.")
Expand All @@ -130,7 +130,7 @@ def start(
# Stop running tests immediately.
self.logger.error("Received a StopExecution exception: %s.", err)
self._interrupt_all_jobs(queue, interrupt_flag)
except:
except Exception:
# Unknown error, stop execution.
self.logger.exception("Encountered an error during test execution.")
self._interrupt_all_jobs(queue, interrupt_flag)
Expand All @@ -147,7 +147,7 @@ def start(
"Received a StopExecution exception when tearing down the fixture: %s.", err
)
teardown_succeeded = False
except:
except Exception:
# Something unexpected happened when tearing down the fixture. We indicate back to
# the executor thread that teardown has failed. This may mean resmoke.py is exiting
# without having terminated all of the child processes it spawned.
Expand Down Expand Up @@ -241,7 +241,7 @@ def _execute_test(self, test: TestCase, hook_failure_flag: Optional[threading.Ev

try:
test.configure(self.fixture, config.NUM_CLIENTS_PER_FIXTURE, config.USE_TENANT_CLIENT)
except:
except Exception:
self.logger.error(
"%s marked as a failure because it could not be configured.",
test.short_description(),
Expand Down Expand Up @@ -410,7 +410,7 @@ def _run_hooks_before_tests(self, test: TestCase, hook_failure_flag: Optional[th
if self.suite_options.fail_fast:
raise errors.StopExecution("A hook's before_test failed")

except:
except Exception:
# Record the before_test() error in 'self.report'.
self.report.startTest(test)
self.report.addError(test, sys.exc_info())
Expand Down Expand Up @@ -438,7 +438,7 @@ def _run_hooks_after_tests(
try:
self.logger.info("Stopping the balancer before running end-test hooks")
self.fixture.stop_balancer()
except:
except Exception:
self.logger.exception(
"%s failed while stopping the balancer for after-test hooks",
test.short_description(),
Expand Down Expand Up @@ -480,15 +480,15 @@ def _run_hooks_after_tests(
if self.suite_options.fail_fast:
raise errors.StopExecution("A hook's after_test failed")

except:
except Exception:
self.report.setError(test, sys.exc_info())
raise

if not background and suite_with_balancer:
try:
self.logger.info("Resuming the balancer after running end-test hooks")
self.fixture.start_balancer()
except:
except Exception:
self.logger.exception(
"%s failed while re-starting the balancer after end-test hooks",
test.short_description(),
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/testing/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def startTest(self, test: TestCase):
self.job_logger.info("Running %s...\n%s", basename, command)
else:
self.job_logger.info("Running %s...", basename)
except:
except Exception:
# This can happen in rare cases like in ProcessTestCase where the process building itself fails
self.job_logger.exception("Failed to form command for test %s" % basename)

Expand Down
6 changes: 3 additions & 3 deletions buildscripts/resmokelib/testing/testcases/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def run_test(self):
except errors.ServerFailure as err:
self.logger.error("An error occurred during the setup of %s: %s", self.fixture, err)
raise
except:
except Exception:
self.logger.exception("An error occurred during the setup of %s.", self.fixture)
raise

Expand All @@ -99,7 +99,7 @@ def run_test(self):
except errors.ServerFailure as err:
self.logger.error("An error occurred during the teardown of %s: %s", self.fixture, err)
raise
except:
except Exception:
self.logger.exception("An error occurred during the teardown of %s.", self.fixture)
raise

Expand Down Expand Up @@ -130,6 +130,6 @@ def run_test(self):
# If the server wasn't already running, we can't exactly fail to abort it.
self.logger.info("Finished aborting %s.", self.fixture)
self.return_code = 0
except:
except Exception:
self.logger.exception("An error occurred while aborting %s.", self.fixture)
raise
4 changes: 2 additions & 2 deletions buildscripts/resmokelib/testing/testcases/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def run_test(self):
self._execute(self.proc)
except self.failureException:
raise
except:
except Exception:
self.logger.exception(
"Encountered an error running %s %s", self.test_kind, self.basename()
)
Expand All @@ -169,7 +169,7 @@ def as_command(self):
try:
proc = self._make_process()
return proc.as_command()
except:
except Exception:
self.logger.exception(
"Encountered an error getting command for %s %s", self.test_kind, self.basename()
)
Expand Down
4 changes: 2 additions & 2 deletions buildscripts/resmokelib/testing/testcases/jstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def run(self):
"""Run the jstest."""
try:
threading.Thread.run(self)
except:
except Exception:
self.exc_info = sys.exc_info()

def __init__(
Expand Down Expand Up @@ -278,7 +278,7 @@ def _run_multiple_copies(self):
thread = self.ThreadWithException(target=test_case.run_test)
threads.append(thread)
thread.start()
except:
except Exception:
self.logger.exception(
"Encountered an error starting threads for jstest %s.", self.basename()
)
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/resmokelib/utils/file_span_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
json.dump(message, file, indent=2)
else:
json.dump(message, file, indent=None, separators=(",", ":"))
except:
except Exception:
logger.exception("Failed to write OTEL metrics to file %s", file_name)
return SpanExportResult.FAILURE

Expand Down
8 changes: 4 additions & 4 deletions buildscripts/tests/test_check_for_noexcept.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def test_get_move_operations_noexcept_matters(self):
""",
)

for snippet in with_noexcept:
for snippet in with_noexcept Exception:
all_moves = get_move_operations(snippet)
noexcept = _noexcept_moves_only(all_moves)
non_noexcept = _nonnoexcept_moves_only(all_moves)
Expand All @@ -495,7 +495,7 @@ def test_get_move_operations_noexcept_matters(self):
len(non_noexcept), 0, msg=f"Expected no non-noexcept move operation: {snippet}"
)

for snippet in without_noexcept:
for snippet in without_noexcept Exception:
all_moves = get_move_operations(snippet)
noexcept = _noexcept_moves_only(all_moves)
non_noexcept = _nonnoexcept_moves_only(all_moves)
Expand All @@ -521,12 +521,12 @@ def test_get_noexcepts(self):
_BASIC_NON_NOEXCEPT_MOVE_OPERATIONS + _BASIC_NON_NOEXCEPT_NON_MOVE_OPERATIONS
)

for snippet in with_noexcept:
for snippet in with_noexcept Exception:
self.assertGreater(
len(get_noexcepts(snippet)), 0, msg=f"Expected noexcept in snippet: {snippet}"
)

for snippet in without_noexcept:
for snippet in without_noexcept Exception:
self.assertEqual(
len(get_noexcepts(snippet)), 0, msg=f"Expected no noexcept in snippet: {snippet}"
)
Expand Down
Loading