How to use the spectacles.utils.log_duration function in spectacles

To help you get started, we’ve selected a few spectacles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spectacles-ci / spectacles / tests / test_utils.py View on Github external
def test_log_SQL(self):
        with self.assertLogs(logger=logger, level="INFO") as cm:
            func = MagicMock()
            func.__name__ = "run_sql"
            decorated_func = utils.log_duration(func)
            decorated_func()
        self.assertIn("INFO:spectacles:Completed SQL validation in", cm.output[0])
github spectacles-ci / spectacles / tests / test_utils.py View on Github external
def test_log_assert(self):
        with self.assertLogs(logger=logger, level="INFO") as cm:
            func = MagicMock()
            func.__name__ = "run_assert"
            decorated_func = utils.log_duration(func)
            decorated_func()
        self.assertIn("INFO:spectacles:Completed data test validation in", cm.output[0])
github spectacles-ci / spectacles / tests / test_utils.py View on Github external
def test_log_content(self):
        with self.assertLogs(logger=logger, level="INFO") as cm:
            func = MagicMock()
            func.__name__ = "run_content"
            decorated_func = utils.log_duration(func)
            decorated_func()
        self.assertIn("INFO:spectacles:Completed content validation in", cm.output[0])
github spectacles-ci / spectacles / tests / test_utils.py View on Github external
def test_log_other(self):
        with self.assertLogs(logger=logger, level="INFO") as cm:
            func = MagicMock()
            func.__name__ = "OtherValidator.validate"
            decorated_func = utils.log_duration(func)
            decorated_func()
        self.assertIn("INFO:spectacles:Completed validation in", cm.output[0])
github spectacles-ci / spectacles / spectacles / cli.py View on Github external
@log_duration
def run_assert(
    project,
    branch,
    explores,
    exclude,
    base_url,
    client_id,
    client_secret,
    port,
    api_version,
    remote_reset,
    import_projects,
    commit_ref,
) -> None:
    runner = Runner(
        base_url,
github spectacles-ci / spectacles / spectacles / cli.py View on Github external
@log_duration
def run_content(
    project,
    branch,
    explores,
    excludes,
    base_url,
    client_id,
    client_secret,
    port,
    api_version,
    remote_reset,
    import_projects,
    commit_ref,
    incremental,
    exclude_personal,
) -> None:
github spectacles-ci / spectacles / spectacles / runner.py View on Github external
    @log_duration
    def validate_data_tests(self) -> Dict[str, Any]:
        with self.branch_manager:
            data_test_validator = DataTestValidator(self.client, self.project)
            results = data_test_validator.validate()
        return results
github spectacles-ci / spectacles / spectacles / runner.py View on Github external
    @log_duration
    def validate_sql(
        self,
        selectors: List[str],
        exclusions: List[str],
        mode: str = "batch",
        concurrency: int = 10,
    ) -> Dict[str, Any]:
        with self.branch_manager:
            sql_validator = SqlValidator(self.client, self.project, concurrency)
            sql_validator.build_project(selectors, exclusions)
            results = sql_validator.validate(mode)
        return results
github spectacles-ci / spectacles / spectacles / cli.py View on Github external
@log_duration
def run_sql(
    log_dir,
    project,
    branch,
    explores,
    exclude,
    base_url,
    client_id,
    client_secret,
    port,
    api_version,
    mode,
    remote_reset,
    import_projects,
    concurrency,
    commit_ref,