def test_is_valid_manifest_format_with_csv(logfile): """ Test that alternative delimiter can be automatically detected """ logging.setLevel(default_logging.ERROR) assert is_valid_manifest_format("tests/test_data/test_manifest.csv") == True assert logfile.read() == "" logging.setLevel(default_logging.WARNING)
def set_log_level_to_warning(): """ By default, only log errors and setup a log output file to read from later """ logging.setLevel(default_logging.WARNING) if os.path.exists("gen3tests.logs"): os.remove("gen3tests.logs") logfile_handler = default_logging.FileHandler("gen3tests.logs") logfile_handler.setFormatter(default_logging.Formatter(LOG_FORMAT)) logging.addHandler(logfile_handler) yield
def test_is_valid_manifest_format_with_empty_url(logfile): """ Test that by default, completely empty url values are allowed """ logging.setLevel(default_logging.ERROR) result = is_valid_manifest_format( "tests/validate_manifest_format/manifests/manifest_with_empty_url.tsv", ) assert logfile.read() == "" assert result == True logging.setLevel(default_logging.WARNING)
def main(ctx, auth_config, endpoint, verbose_logs, very_verbose_logs, only_error_logs): """Gen3 Command Line Interface""" ctx.ensure_object(dict) ctx.obj["auth_config"] = auth_config ctx.obj["endpoint"] = endpoint ctx.obj["auth_factory"] = AuthFactory(auth_config) if very_verbose_logs: logger = cdislogging.get_logger(__name__, format=gen3.LOG_FORMAT, log_level="debug") sdklogging.setLevel("DEBUG") elif verbose_logs: logger = cdislogging.get_logger(__name__, format=gen3.LOG_FORMAT, log_level="info") sdklogging.setLevel("INFO") elif only_error_logs: logger = cdislogging.get_logger(__name__, format=gen3.LOG_FORMAT, log_level="error") sdklogging.setLevel("ERROR") else: logger = cdislogging.get_logger(__name__, format=gen3.LOG_FORMAT, log_level="warning") sdklogging.setLevel("WARNING")