def selftest(logger):
    selftest_started = time.perf_counter()
    result = SelfTestResult()
    test_suite = TestSuite()
    for test_case in SELFTEST_CASES:
        test_suite.addTest(defaultTestLoader.loadTestsFromTestCase(test_case))
    test_suite.run(result)
    result.log_results(logger)
    successful_tests = result.successful_test_count()
    count_mismatch = successful_tests != SELFTEST_COUNT
    if result.wasSuccessful() and count_mismatch:
        # only print this if all tests succeeded
        logger.error("self test count (%d != %d) mismatch, either test discovery is broken or a test was added "
                     "without updating borg.selftest",
                     successful_tests, SELFTEST_COUNT)
    if not result.wasSuccessful() or count_mismatch:
        logger.error("self test failed\n"
                     "This is a bug either in Borg or in the package / distribution you use.")
        sys.exit(2)
        assert False, "sanity assertion failed: ran beyond sys.exit()"
    selftest_elapsed = selftest_started - time.perf_counter()
    logger.debug("%d self tests completed in %.2f seconds", successful_tests, selftest_elapsed)
dataset/ETHPy150Open borgbackup/borg/borg/selftest.py/selftest/swapped operands of `-`