Skip to content

Commit

Permalink
Merge pull request #117 from stuartcampbell/add-more-tests
Browse files Browse the repository at this point in the history
Initial set of CI tests together with a ephemeral MongoDB container
  • Loading branch information
danielballan authored Nov 1, 2024
2 parents dac1b3d + 6358db6 commit 52be099
Show file tree
Hide file tree
Showing 23 changed files with 533 additions and 138 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v4

# Install Kerberos dependencies (for N2SNUserTools)
- name: Install krb5-devel
run: sudo apt-get -y install libkrb5-dev

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
- name: Install
run: |
pip install .
# This requirements-dev.txt is too much for this step - will trim later.
- name: Install test requirements
run: |
pip install -r requirements-dev.txt
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.11.0
with:
mongodb-version: "8.0.0"

- name: Test with pytest
run: |
set -vxeuo pipefail
coverage run -m pytest -v
coverage report
28 changes: 16 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ build-backend = "hatchling.build"

[project]
name = "nsls2api"
dynamic = ["version","dependencies"]
dynamic = ["version", "dependencies"]
description = ''
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.11"
license = "BSD-3-Clause"
authors = [
{ name = "Stuart Campbell", email = "scampbell@bnl.gov" },
{ name = "Stuart Campbell", email = "scampbell@bnl.gov" },
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
]

[project.scripts]
Expand All @@ -41,7 +41,7 @@ hooks.vcs.version-file = "src/nsls2api/_version.py"

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/.github",
]

#[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
Expand All @@ -51,6 +51,10 @@ exclude = [
target_version = ['py311']
include = '\.pyi?$'

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"

[tool.ruff]
target-version = "py311"

6 changes: 5 additions & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
asgi-lifespan
asyncer
black
bunnet
coverage
ipython
locust
pyright
pytest
pytest-asyncio
ruff
textual-dev
textual-dev
69 changes: 42 additions & 27 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements-dev.in -o requirements-dev.txt
aiohappyeyeballs==2.4.0
aiohappyeyeballs==2.4.3
# via aiohttp
aiohttp==3.10.5
aiohttp==3.10.10
# via
# aiohttp-jinja2
# textual-dev
Expand All @@ -13,15 +13,17 @@ aiosignal==1.3.1
# via aiohttp
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
anyio==4.6.2.post1
# via asyncer
asgi-lifespan==2.1.0
# via -r requirements-dev.in
asttokens==2.4.1
# via stack-data
asyncer==0.0.8
# via -r requirements-dev.in
attrs==24.2.0
# via aiohttp
black==24.8.0
black==24.10.0
# via -r requirements-dev.in
blinker==1.8.2
# via flask
Expand All @@ -33,7 +35,7 @@ certifi==2024.8.30
# via
# geventhttpclient
# requests
charset-normalizer==3.3.2
charset-normalizer==3.4.0
# via requests
click==8.1.7
# via
Expand All @@ -43,9 +45,11 @@ click==8.1.7
# textual-dev
configargparse==1.7
# via locust
coverage==7.6.4
# via -r requirements-dev.in
decorator==5.1.1
# via ipython
dnspython==2.6.1
dnspython==2.7.0
# via pymongo
executing==2.1.0
# via stack-data
Expand All @@ -58,17 +62,15 @@ flask-cors==5.0.0
# via locust
flask-login==0.6.3
# via locust
frozenlist==1.4.1
frozenlist==1.5.0
# via
# aiohttp
# aiosignal
gevent==24.2.1
# via
# geventhttpclient
# locust
gevent==24.10.3
# via geventhttpclient
geventhttpclient==2.3.1
# via locust
greenlet==3.1.0
greenlet==3.1.1
# via gevent
idna==3.10
# via
Expand All @@ -77,7 +79,7 @@ idna==3.10
# yarl
iniconfig==2.0.0
# via pytest
ipython==8.27.0
ipython==8.29.0
# via -r requirements-dev.in
itsdangerous==2.2.0
# via flask
Expand All @@ -92,14 +94,14 @@ lazy-model==0.2.0
# via bunnet
linkify-it-py==2.0.3
# via markdown-it-py
locust==2.31.6
locust==2.32.0
# via -r requirements-dev.in
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# rich
# textual
markupsafe==2.1.5
markupsafe==3.0.2
# via
# jinja2
# werkzeug
Expand All @@ -119,6 +121,8 @@ multidict==6.1.0
# yarl
mypy-extensions==1.0.0
# via black
nodeenv==1.9.1
# via pyright
packaging==24.1
# via
# black
Expand All @@ -129,15 +133,17 @@ pathspec==0.12.1
# via black
pexpect==4.9.0
# via ipython
platformdirs==4.3.4
platformdirs==4.3.6
# via
# black
# textual
pluggy==1.5.0
# via pytest
prompt-toolkit==3.0.47
prompt-toolkit==3.0.48
# via ipython
psutil==6.0.0
propcache==0.2.0
# via yarl
psutil==6.1.0
# via locust
ptyprocess==0.7.0
# via pexpect
Expand All @@ -153,31 +159,39 @@ pygments==2.18.0
# via
# ipython
# rich
pymongo==4.8.0
pymongo==4.10.1
# via bunnet
pyright==1.1.386
# via -r requirements-dev.in
pytest==8.3.3
# via
# -r requirements-dev.in
# pytest-asyncio
pytest-asyncio==0.24.0
# via -r requirements-dev.in
pyzmq==26.2.0
# via locust
requests==2.32.3
# via locust
rich==13.8.1
rich==13.9.3
# via
# textual
# textual-serve
ruff==0.6.5
ruff==0.7.1
# via -r requirements-dev.in
setuptools==75.1.0
setuptools==75.2.0
# via
# zope-event
# zope-interface
six==1.16.0
# via asttokens
sniffio==1.3.1
# via anyio
# via
# anyio
# asgi-lifespan
stack-data==0.6.3
# via ipython
textual==0.79.1
textual==0.85.0
# via
# textual-dev
# textual-serve
Expand All @@ -195,6 +209,7 @@ typing-extensions==4.12.2
# via
# pydantic
# pydantic-core
# pyright
# textual
# textual-dev
uc-micro-py==1.0.3
Expand All @@ -205,14 +220,14 @@ urllib3==2.2.3
# requests
wcwidth==0.2.13
# via prompt-toolkit
werkzeug==3.0.4
werkzeug==3.0.6
# via
# flask
# flask-login
# locust
yarl==1.11.1
yarl==1.16.0
# via aiohttp
zope-event==5.0
# via gevent
zope-interface==7.0.3
zope-interface==7.1.1
# via gevent
Loading

0 comments on commit 52be099

Please sign in to comment.