Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests #1

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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']
os: [ubuntu-latest]
python-version: ['3.9']


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 }}

- name: download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install ControlFlow
run: uv pip install --system ".[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/action@v3.0.1
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 = "153965+jlowin@users.noreply.github.com" }
]
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