Skip to content

Commit

Permalink
In run_checkpoint_validation remove logging warning and remove none i…
Browse files Browse the repository at this point in the history
…n log output if no result name is present (#37)

<!-- 
Thanks for opening a pull request to prefect-great-expectations 🎉!

We've got a few requests to help us review contributions:

- Make sure that your title neatly summarizes the proposed changes.
- Provide a short overview of the change and the value it adds.
- Share an example to help us understand the change in user experience.
- Run `pre-commit install && pre-commit run --all` for linting.

Happy engineering!
-->

<!-- Include an overview here -->

<!-- Link to issue -->
Closes #

### Example
<!-- 
Share an example of the change in action.

A code blurb is best. Changes to features should include an example that
is executable by a new user.
-->

### Checklist
<!-- These boxes may be checked after opening the pull request. -->

- [ ] This pull request references any related issue by including
"Closes #<ISSUE_NUMBER>"
- If no issue exists and your change is not a small fix, please [create
an
issue](https://github.com/PrefectHQ/prefect-great-expectations/issues/new/choose)
first.
- [ ] This pull request includes tests or only affects documentation.
- [x] Summarized PR's changes in
[CHANGELOG.md](https://github.com/PrefectHQ/prefect-great-expectations/blob/main/CHANGELOG.md)

---------

Co-authored-by: Alexander Streed <alex.s@prefect.io>
  • Loading branch information
discdiver and desertaxle authored Jun 21, 2023
1 parent d753a19 commit 7f77b3d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Fixed
- Update logging to use `warning` instead of `warn` to avoid deprecation warning and remove None in logs if no run name is present - [#37]([https://github.com/PrefectHQ/prefect-great-expectations/pull/14](https://github.com/PrefectHQ/prefect-great-expectations/pull/37))

### Security

Expand Down
8 changes: 5 additions & 3 deletions prefect_great_expectations/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ def example_flow():
result = checkpoint.run(run_name=run_name, **checkpoint_kwargs)

if not result.success:
logger.warn(
"Great Expectations validation run %s failed", result.run_id.run_name
logger.warning(
"Great Expectations validation run %s failed",
result.run_id.run_name if result.run_id.run_name else "",
)
if raise_on_validation_failure:
raise GreatExpectationValidationError(result)
else:
logger.info(
"Great Expectations validation run %s succeeded", result.run_id.run_name
"Great Expectations validation run %s succeeded",
result.run_id.run_name if result.run_id.run_name else "",
)

return result
22 changes: 22 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest
from prefect.testing.utilities import prefect_test_harness


@pytest.fixture(scope="session", autouse=True)
def prefect_db():
"""
Sets up test harness for temporary DB during test runs.
"""
with prefect_test_harness():
yield


@pytest.fixture(autouse=True)
def reset_object_registry():
"""
Ensures each test has a clean object registry.
"""
from prefect.context import PrefectObjectRegistry

with PrefectObjectRegistry():
yield

0 comments on commit 7f77b3d

Please sign in to comment.