Use freezegun in tests and add last_fetched to snapshots #2762
Workflow file for this run
This file contains 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: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: test-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
legacy: | |
name: With pytest with Home Assistant (min. supported version) | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout the repository | |
uses: actions/[email protected] | |
- name: 🛠️ Set up Python 3.11 | |
uses: actions/[email protected] | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements_base.txt | |
requirements_test.txt | |
- name: 📦 Install dependencies | |
run: | | |
scripts/install/pip_packages --requirement requirements_test.txt | |
scripts/install/core | |
scripts/install/frontend | |
- name: 🏃 Run tests | |
env: | |
PYTEST: true | |
run: | | |
python3 -m pytest | |
dev: | |
name: With pytest with Home Assistant (${{ matrix.homeassistant-version }}) & Python (${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
homeassistant-version: | |
- "dev" | |
python-version: | |
- "3.12" | |
steps: | |
- name: 📥 Checkout the repository | |
uses: actions/[email protected] | |
- name: 🛠️ Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements_base.txt | |
requirements_test.txt | |
- name: 📦 Install dependencies | |
run: | | |
scripts/install/pip_packages --requirement requirements_test.txt | |
scripts/install/core_dev | |
scripts/install/frontend | |
- name: 🏃 Run tests | |
env: | |
PYTEST: true | |
run: | | |
python3 -m pytest | |
- name: 📤 Upload coverage to Codecov | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
scripts/coverage | |
curl -sfSL https://codecov.io/bash | bash - |