Skip to content

Commit

Permalink
test: fix and enable hypothesis profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jan 28, 2024
1 parent 037025d commit a5ba241
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

env:
FORCE_COLOR: "1"
SQLALCHEMY_WARN_20: "1"
HYPOTHESIS_PROFILE: "ci"

jobs:
check_setuptools_install:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ibis-backends-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ concurrency:

env:
FORCE_COLOR: "1"
SQLALCHEMY_WARN_20: "1"
HYPOTHESIS_PROFILE: "ci"

jobs:
test_backends:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ibis-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ env:
FORCE_COLOR: "1"
ODBCSYSINI: "${{ github.workspace }}/ci/odbc"
SQLALCHEMY_WARN_20: "1"
HYPOTHESIS_PROFILE: "ci"

jobs:
test_backends:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ibis-docs-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:
- name: run doctest
# keep HOME because duckdb (which we use for doctests) wants to use
# that for extensions
run: nix develop --ignore-environment --keep HOME -c just doctest
run: nix develop --ignore-environment --keep HOME --keep HYPOTHESIS_PROFILE -c just doctest

- name: generate api docs
run: nix develop --ignore-environment -c just docs-apigen --verbose
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
- name: run doctests
# keep HOME because duckdb (which we use for doctests) wants to use
# that for extensions
run: nix develop --ignore-environment --keep HOME -c just doctest
run: nix develop --ignore-environment --keep HOME --keep HYPOTHESIS_PROFILE -c just doctest

- name: build api docs
run: nix develop --ignore-environment -c just docs-apigen --verbose
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ibis-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ concurrency:

env:
FORCE_COLOR: "1"
SQLALCHEMY_WARN_20: "1"
HYPOTHESIS_PROFILE: "ci"

jobs:
test_core:
name: Test ${{ matrix.os }} python-${{ matrix.python-version }}
env:
SQLALCHEMY_WARN_20: "1"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
32 changes: 32 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import annotations

import os

import hypothesis as h

# setup hypothesis profiles
h.settings.register_profile(
"ci",
max_examples=1000,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)
h.settings.register_profile(
"dev",
max_examples=50,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)
h.settings.register_profile(
"debug",
max_examples=10,
verbosity=h.Verbosity.verbose,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)

# load default hypothesis profile, either set HYPOTHESIS_PROFILE environment
# variable or pass --hypothesis-profile option to pytest, to see the generated
# examples try:
# pytest pyarrow -sv --hypothesis-profile=debug
h.settings.load_profile(os.environ.get("HYPOTHESIS_PROFILE", "dev"))
32 changes: 0 additions & 32 deletions ibis/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
from __future__ import annotations

import os

import hypothesis as h

# setup hypothesis profiles
h.settings.register_profile(
"ci",
max_examples=1000,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)
h.settings.register_profile(
"dev",
max_examples=50,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)
h.settings.register_profile(
"debug",
max_examples=10,
verbosity=h.Verbosity.verbose,
suppress_health_check=[h.HealthCheck.too_slow],
deadline=None,
)

# load default hypothesis profile, either set HYPOTHESIS_PROFILE environment
# variable or pass --hypothesis-profile option to pytest, to see the generated
# examples try:
# pytest pyarrow -sv --hypothesis-profile=debug
h.settings.load_profile(os.environ.get("HYPOTHESIS_PROFILE", "dev"))

0 comments on commit a5ba241

Please sign in to comment.