Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed Apr 5, 2024
1 parent 1620a28 commit 3c3a726
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 9 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Tests

env:
# enable colored output
# https://github.com/pytest-dev/pytest/issues/7443
PY_COLORS: 1

on:
push:
branches: ["main"]
paths:
- .github/workflows/run-tests.yml
- src/**
- tests/**
- pyproject.toml
- setup.py

pull_request:
paths:
- .github/workflows/run-tests.yml
- src**
- tests/**
- pyproject.toml
- setup.py

workflow_dispatch:

permissions:
contents: read

jobs:
run_tests:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
# run no_llm tests across all python versions and oses
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']

include:
# Run LLM tests on 3.9
- python-version: '3.9'
os: 'ubuntu-latest'


runs-on: ${{ matrix.os }}

env:
CONTROLFLOW_OPENAI_API_KEY: ${{ secrets.CONTROLFLOW_OPENAI_API_KEY }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install ControlFlow
run: pip install ".[tests]"

- name: Run tests
run: pytest -n auto -vv
if: ${{ !(github.event.pull_request.head.repo.fork) }}
31 changes: 31 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run static analysis

env:
# enable colored output
# https://github.com/pytest-dev/pytest/issues/7443
PY_COLORS: 1

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:

static_analysis:
timeout-minutes: 1

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Run pre-commit
uses: pre-commit/[email protected]
30 changes: 21 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ authors = [
{ name = "Jeremiah Lowin", email = "[email protected]" }
]
dependencies = [
"marvin>=2.3.1",
"marvin @ git+https://github.com/prefecthq/marvin@main",
"prefect @ git+https://github.com/prefecthq/prefect@main",
# can remove when prefect fully migrates to pydantic 2
"pydantic>=2",
]
readme = "README.md"
Expand All @@ -17,19 +18,30 @@ keywords = ["ai", "chatbot", "llm", "NLP", "natural language processing", "prefe
[project.urls]
Code = "https://github.com/jlowin/ControlFlow"

[project.optional-dependencies]
tests = [
"pytest-asyncio>=0.18.2,!=0.22.0,<0.23.0",
"pytest-env>=0.8,<2.0",
"pytest-rerunfailures>=10,<14",
"pytest-sugar>=0.9,<2.0",
"pytest>=8.1.1",
"pytest-timeout",
"pytest-xdist",
"pre-commit>=3.7.0",
]
dev = [
"control_flow[tests]",
"ipython>=8.22.2",
"pdbpp>=0.10.3",
"ruff>=0.3.4",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"ipython>=8.22.2",
"pdbpp>=0.10.3",
"pre-commit>=3.7.0",
"ruff>=0.3.4",
"pytest>=8.1.1",
]
managed = true

[tool.hatch.metadata]
allow-direct-references = true
Expand Down

0 comments on commit 3c3a726

Please sign in to comment.