Skip to content

Commit 8ea4f2c

Browse files
authored
Merge pull request #167 from mlibrary/add-python-tests
Add python tests
2 parents 7c6430e + 3f96f0a commit 8ea4f2c

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

.github/workflows/scratch.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010

1111
jobs:
1212
get-short-tag:
13-
id: get-short-tag
1413
runs-on: ubuntu-latest
1514
steps:
1615
- name: save short tag to environment

.github/workflows/tests.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: push
44

55
jobs:
66
# Run tests
7-
test:
7+
test-ruby:
88
runs-on: ubuntu-latest
99
env:
1010
BUNDLE_GEMFILE: ${{ github.workspace }}/umich_catalog_indexing/Gemfile
@@ -19,7 +19,7 @@ jobs:
1919
working-directory: ./umich_catalog_indexing
2020
run: cat env.* > .env
2121
- name: Load .env file
22-
uses: xom9ikk/dotenv@v2
22+
uses: xom9ikk/dotenv@v2.3.0
2323
with:
2424
path: umich_catalog_indexing
2525
- name: copy libLocInfo.yaml
@@ -29,3 +29,33 @@ jobs:
2929
- name: Run tests
3030
working-directory: ./umich_catalog_indexing
3131
run: bundle exec rspec
32+
33+
test-python:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v5
37+
- name: Create .env file
38+
working-directory: ./api
39+
run: cat env.* > .env
40+
- name: Load .env file
41+
uses: xom9ikk/dotenv@v2.3.0
42+
with:
43+
path: api
44+
- name: Install poetry
45+
run: pipx install poetry
46+
- name: Set up Python 3.11
47+
uses: actions/setup-python@v6
48+
with:
49+
python-version: '3.11'
50+
cache: 'poetry'
51+
- name: install poetry packages
52+
working-directory: ./api
53+
run: poetry install --no-root
54+
- name: Linting
55+
working-directory: ./api
56+
run: poetry run ruff check
57+
- name: Run tests
58+
env:
59+
CI: "true"
60+
working-directory: ./api
61+
run: poetry run pytest

api/catalog_api/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pydantic import BaseModel, ConfigDict, Field, AliasGenerator
2-
from typing import Optional, Annotated
2+
from typing import Optional
33
import datetime
44

55

api/env.example

Whitespace-only changes.

api/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ authors = [
88
readme = "README.md"
99
packages = [{include = "catalog-api"}]
1010

11+
[tool.ruff]
12+
exclude = [".venv",".vscode",".vscode-server", ".local"]
13+
1114
[tool.poetry.dependencies]
1215
python = "^3.11"
1316
requests = "^2.31.0"

api/tests/test_record.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import pytest
22
import json
33
import pymarc
4-
import xml.etree.ElementTree as ET
5-
from io import StringIO
64
import string
75
from datetime import datetime
86
from dataclasses import dataclass, field

0 commit comments

Comments
 (0)