add script to run image tests in plotly.py #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| pull_request: | |
| types: [opened, reopened] | |
| jobs: | |
| test-core: | |
| name: Core tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| uv venv | |
| source .venv/bin/activate | |
| uv lock --check | |
| uv sync --extra dev_core | |
| python --version | |
| - name: Test core | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_core | |
| test-optional: | |
| name: Optional tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Chrome for Pytest | |
| uses: ./.github/actions/setup-chrome-for-pytest | |
| - name: Install dependencies | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| uv venv | |
| source .venv/bin/activate | |
| uv sync --extra dev_optional | |
| python --version | |
| - name: Test core | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_core | |
| - name: Test optional | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_optional | |
| - name: Test utils | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_plotly_utils/ | |
| - name: Test io | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_io | |
| - name: Test dependencies not imported | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest -x test_init/test_dependencies_not_imported.py | |
| - name: Test lazy imports | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest -x test_init/test_lazy_imports.py | |
| test-optional-legacy-pandas: | |
| name: Optional tests, Pandas 1 (Python 3.9, Pandas 1.2.4) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.9" | |
| - name: Set up Chrome for browser tests | |
| uses: ./.github/actions/setup-chrome-for-pytest | |
| - name: Install dependencies | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| uv venv | |
| source .venv/bin/activate | |
| uv sync --extra dev_optional | |
| uv pip install pandas==1.2.4 numpy==1.26.4 | |
| - name: Test core | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_core | |
| - name: Test optional | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_optional | |
| - name: Test utils | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_plotly_utils/ | |
| - name: Test io | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_io | |
| - name: Test dependencies not imported | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest -x test_init/test_dependencies_not_imported.py | |
| - name: Test lazy imports | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest -x test_init/test_lazy_imports.py | |
| test-kaleido-v0: | |
| name: Optional tests (Kaleido only), Kaleido v0 (Python 3.12, Kaleido v0.2.1) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Chrome | |
| uses: browser-actions/setup-chrome@v2.1.1 | |
| with: | |
| install-chromedriver: true | |
| - name: Install dependencies | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| uv venv | |
| source .venv/bin/activate | |
| uv sync --extra dev_optional | |
| uv pip uninstall kaleido | |
| uv pip install kaleido==0.2.1 | |
| python --version | |
| - name: Test plotly.io image output with Kaleido v0 | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest tests/test_optional/test_kaleido |