Skip to content

Commit

Permalink
[DOCS] Quickstart code under test (#7542)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyburdi committed Apr 1, 2023
1 parent dd63701 commit b68fa9a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
27 changes: 26 additions & 1 deletion ci/azure-pipelines-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,33 @@ stages:
python -c "import great_expectations as gx; print('Successfully imported GX Version:', gx.__version__)"
displayName: 'Import Great Expectations'
- stage: quickstart
dependsOn: scope_check
pool:
vmImage: 'ubuntu-20.04'

jobs:
- job: quickstart

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
displayName: 'Use Python 3.7'

- script: |
pip install --constraint constraints-dev.txt ".[test]"
pip uninstall -y sqlalchemy
displayName: 'Install GX and required dependencies (i.e. not sqlalchemy)'
- script: |
pytest -v --no-sqlalchemy --docs-tests -m integration -k "test_docs[quickstart]" tests/integration/test_script_runner.py
displayName: 'Run Quickstart'
- stage: required
dependsOn: [scope_check, lint, import_ge, custom_checks, unit_tests]
dependsOn: [scope_check, lint, import_ge, custom_checks, unit_tests, quickstart]
pool:
vmImage: 'ubuntu-20.04'

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx_api_docs_source/public_api_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ def main():
# any methods or classes you are adding to documentation with the @public_api
# decorator and any relevant "new" or "deprecated" public api decorators.
# If the actual is lower than the threshold, please reduce the threshold.
PUBLIC_API_MISSING_THRESHOLD = 96 # TODO: reduce this number again once this works for the Fluent DS dynamic methods
PUBLIC_API_MISSING_THRESHOLD = 97 # TODO: reduce this number again once this works for the Fluent DS dynamic methods
if len(printable_definitions) != PUBLIC_API_MISSING_THRESHOLD:
error_msg_prefix = f"There are {len(printable_definitions)} items missing from the public API, we currently allow {PUBLIC_API_MISSING_THRESHOLD}."
if len(printable_definitions) > PUBLIC_API_MISSING_THRESHOLD:
Expand Down
Empty file.
28 changes: 28 additions & 0 deletions tests/integration/docusaurus/tutorials/quickstart/quickstart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import great_expectations as gx

# Set up
context = gx.get_context()

# Connect to data
validator = context.sources.pandas_default.read_csv(
"https://raw.githubusercontent.com/great-expectations/gx_tutorials/main/data/yellow_tripdata_sample_2019-01.csv"
)

# Create Expectations
validator.expect_column_values_to_not_be_null("pickup_datetime")
validator.expect_column_values_to_be_between("passenger_count", auto=True)

# Validate data
checkpoint = gx.checkpoint.SimpleCheckpoint(
name="my_quickstart_checkpoint",
data_context=context,
validator=validator,
)
checkpoint_result = checkpoint.run()

# View results
validation_result_identifier = checkpoint_result.list_validation_result_identifiers()[0]
context.open_data_docs(resource_identifier=validation_result_identifier)

# Save the Data Context for future use
context.convert_to_file_context()
10 changes: 9 additions & 1 deletion tests/integration/test_script_runner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Run integration and docs tests.
Individual tests can be run by setting the '-k' flag and referencing the name of test, like the following example:
pytest -v --docs-tests -m integration -k "test_docs[migration_guide_spark_v2_api]" tests/integration/test_script_runner.py
pytest -v --docs-tests -m integration -k "test_docs[quickstart]" tests/integration/test_script_runner.py
"""

import importlib.machinery
Expand Down Expand Up @@ -240,9 +240,17 @@
),
]

quickstart = [
IntegrationTestFixture(
name="quickstart",
user_flow_script="tests/integration/docusaurus/tutorials/quickstart/quickstart.py",
),
]


# populate docs_test_matrix with sub-lists
docs_test_matrix += local_tests
docs_test_matrix += quickstart
docs_test_matrix += spark_integration_tests
docs_test_matrix += sqlite_integration_tests
docs_test_matrix += mysql_integration_tests
Expand Down

0 comments on commit b68fa9a

Please sign in to comment.