Skip to content

Commit

Permalink
Migrate from Poetry to PDM (3)
Browse files Browse the repository at this point in the history
Update test.yml
  • Loading branch information
dostuffthatmatters committed Jan 24, 2024
1 parent e033b82 commit 79e2e1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
30 changes: 7 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,26 @@ jobs:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
id: setup-python-env
with:
python-version: ${{ matrix.python_version }}

# try to load cached venv
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python-env.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
cache: "pip"

# install & configure poetry if cache does not exist
- name: Install Poetry
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with=dev
run: pip install ".[dev]"

# run tests
- name: Run pytests
env:
GITHUB_REPOSITORY: ${{ github.action_repository }}
GITHUB_ACCESS_TOKEN: ${{ github.token }}
run: .venv/bin/python -m pytest tests/ -m "library"
run: python -m pytest tests/ -m "library"

- name: Check whether code formatting is correct
run: |
.venv/bin/python -m yapf em27_metadata --recursive --quiet
.venv/bin/python -m yapf tests --recursive --quiet
python -m yapf em27_metadata --recursive --quiet
python -m yapf tests --recursive --quiet
11 changes: 8 additions & 3 deletions tests/test_static_types.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import os
import sys
import pytest

PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


@pytest.mark.library
def test_static_types() -> None:
print("removing old mypy cache")
r1 = os.system("rm -rf .mypy_cache")
r1 = os.system(f"cd {PROJECT_DIR} && rm -rf .mypy_cache")
assert r1 == 0, "command returned non-zero exit code"

print("checking em27_metadata/")
r2 = os.system(".venv/bin/python -m mypy em27_metadata/")
r2 = os.system(
f"cd {PROJECT_DIR} && {sys.executable} -m mypy em27_metadata/"
)
assert r2 == 0, "command returned non-zero exit code"

print("checking tests/")
r3 = os.system(".venv/bin/python -m mypy tests/")
r3 = os.system(f"cd {PROJECT_DIR} && {sys.executable} -m mypy tests/")
assert r3 == 0, "command returned non-zero exit code"

0 comments on commit 79e2e1d

Please sign in to comment.