Skip to content

Commit

Permalink
remove all gx artifacts, and run gx scripts in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulalgorithm committed Oct 30, 2024
1 parent cfe4f22 commit 3e7e9f6
Show file tree
Hide file tree
Showing 31 changed files with 51 additions and 1,203 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
run: |
poetry run coverage run -m pytest
poetry run coverage xml
env:
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }}
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}

- name: Codecov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ poetry.toml
# Minio system files
tests/s3/data/.minio.sys

# GX artifacts
tests/great_expectations/*/gx
# GX snowflake config in tests
tests/great_expectations/snowflake/config.yml

Expand Down
26 changes: 25 additions & 1 deletion tests/great_expectations/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# GX test cases

A test case in the unit test is a directory that has a file named `run.py`. In the file, there should be a `run` method that cleans up the `gx` directory, creates the context in the directory and use `file` as the mode. In other words, it should look like this:

```python
import great_expectations as gx
import shutil
from pathlib import Path

def run() -> None:

# Clear gx context.
if (current_path / "gx").exists():
shutil.rmtree(current_path / "gx")

# Create Data Context.
context = gx.get_context(mode="file", project_root_dir=current_path)

# ... snipped ...

if __name__ == "__main__":
run()
```

Running `run.py` in each directory will regenerate the `gx` directory, which is where GX artifacts are stored.

## Snowflake
Expand All @@ -14,4 +36,6 @@ role: role
warehouse: wh
```
When running `run.py`, remember to substitute the connection string (which has sensitive information inside!) with some bogus value in `great_expectations.yml`. The crawler can still parse it if the values are fake.
### CI
Pass environment variables so that the test can run.
Empty file.
12 changes: 0 additions & 12 deletions tests/great_expectations/basic_sql/gx/checkpoints/checkpoint.json

This file was deleted.

This file was deleted.

This file was deleted.

101 changes: 0 additions & 101 deletions tests/great_expectations/basic_sql/gx/great_expectations.yml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3e7e9f6

Please sign in to comment.