Пример #1
0
def run_outliers():
    """
    Entrypoint into ee-outliers.
    From here we start using the appropriate run mode.
    """
    # If running in test mode, we just want to run the tests and exit as quick as possible.
    # no need to set up other things like logging, which should happen afterwards.
    if settings.args.run_mode == "tests":
        test_filename = 'test_*.py'
        test_directory = '/app/tests/unit_tests'

        suite = unittest.TestLoader().discover(test_directory,
                                               pattern=test_filename)
        test_result = unittest.TextTestRunner(verbosity=settings.config.getint(
            "general", "log_verbosity")).run(suite)
        sys.exit(not test_result.wasSuccessful())

    # At this point, we know we are not running tests, so we should set up logging,
    # parse the configuration files, etc.
    setup_logging()
    print_intro()

    # Check no duplicate in settings
    error = settings.check_no_duplicate_key()
    if error is not None:
        logging.logger.warning(
            'duplicate value detected in configuration file. Only the last specified value will be used: %s',
            error)

    # Everything has been setup correctly, we can now start analysis in the correct run mode
    if settings.args.run_mode == "daemon":
        run_daemon_mode()

    elif settings.args.run_mode == "interactive":
        run_interactive_mode()
Пример #2
0
 def test_error_on_duplicate_section_check(self):
     self.test_settings.change_configuration_path(test_whitelist_duplicate_section_file)
     result = settings.check_no_duplicate_key()
     self.assertIsInstance(result, DuplicateSectionError)