Skip to content

Commit

Permalink
Fix test_reactive_logic_unary_ops on Python 3.12 (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed Jun 19, 2024
1 parent b116e67 commit c0fa26e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
CHANS: "-c pyviz"
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
- name: Set output
Expand Down Expand Up @@ -60,10 +60,10 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: env setup
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Set output
Expand All @@ -47,7 +47,7 @@ jobs:
- name: build docs
run: hatch -v run docs:build
- name: Deploy dev
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'dev') ||
(github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
Expand All @@ -60,7 +60,7 @@ jobs:
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'main') ||
(github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./builtdocs
Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
name: Run pre-commit hooks
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: "1"
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
Expand All @@ -41,13 +41,13 @@ jobs:
python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9"]') || fromJSON('["3.8", "3.10", "3.12"]') }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: "100"
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand All @@ -59,19 +59,17 @@ jobs:
if: contains(matrix.platform, 'ubuntu') && matrix.python-version == '3.8'
run: echo "PIP_ONLY_BINARY=blosc2" >> $GITHUB_ENV
- name: run unit tests
if: matrix.python-version != '3.12'
run: hatch -v run +py=${{ matrix.python-version }} tests:with_coverage
- name: run unit tests (3.12 only)
if: matrix.python-version == '3.12'
run: |
pip install -e ".[tests]"
coverage run --source=numbergen,param -m pytest -v tests
coverage report
coverage xml
- name: run examples tests
# A notebook fails on Windows (UNIX path used in an example)
# No need to run these tests for PyPy really
if: contains(matrix.platform, 'ubuntu') && !startsWith(matrix.python-version, 'py') && matrix.python-version != '3.12'
if: contains(matrix.platform, 'ubuntu') && !startsWith(matrix.python-version, 'py')
run: hatch -v run +py=${{ matrix.python-version }} tests_examples:examples
- uses: codecov/codecov-action@v3
if: github.event_name == 'push'
- name: Upload coverage reports to Codecov
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tests-deser = [
"tables",
]
tests-examples = [
"pytest <8.1", # https://github.com/computationalmodelling/nbval/issues/202
"pytest",
"pytest-asyncio",
"pytest-xdist",
"nbval",
Expand Down Expand Up @@ -210,6 +210,7 @@ python = [
"3.9",
"3.10",
"3.11",
"3.12",
]

[tool.hatch.envs.tests_examples.scripts]
Expand Down
4 changes: 2 additions & 2 deletions tests/testreactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def test_reactive_logic_binary_ops(op):

@pytest.mark.parametrize('op', LOGIC_UNARY_OPERATORS)
def test_reactive_logic_unary_ops(op):
assert op(rx(True)).rx.value == op(True)
assert op(rx(False)).rx.value == op(False)
assert op(rx(1)).rx.value == op(1)
assert op(rx(0)).rx.value == op(0)

@pytest.mark.parametrize('op', LOGIC_BINARY_OPERATORS)
def test_reactive_logic_binary_ops_reverse(op):
Expand Down

0 comments on commit c0fa26e

Please sign in to comment.