Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MJedr committed Jul 12, 2023
1 parent da0e0df commit 7a998a5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
jobs:
tests:
name: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- run: |
python -m pip install --upgrade pip
pip install -e .[all,tests]
name: Install dependencies
- run: pip freeze
name: List dependencies
- run: export PYTHONWARNINGS=default && python -m pytest tests
name: Run tests
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@
packages=["flask_sqlalchemy"],
include_package_data=True,
python_requires=">= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*",
install_requires=["Flask>=0.10", "SQLAlchemy>=0.8.0"],
install_requires=["Flask>=0.10", "SQLAlchemy<2.0"],
extras_require={
"tests": [
"pytest",
"coverage",
"blinker",
"mock"
]
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand Down
14 changes: 9 additions & 5 deletions tests/test_basic_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

import warnings
import flask

import flask_sqlalchemy as fsa
Expand Down Expand Up @@ -53,9 +55,11 @@ def test_helper_api(db):

def test_persist_selectable(app, db, Todo, recwarn):
""" In SA 1.3, mapper.mapped_table should be replaced with mapper.persist_selectable """
with app.test_request_context():
todo = Todo('Test 1', 'test')
db.session.add(todo)
db.session.commit()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
with app.test_request_context():
todo = Todo('Test 1', 'test')
db.session.add(todo)
db.session.commit()

assert len(recwarn) == 0
assert len(recwarn) == 0

0 comments on commit 7a998a5

Please sign in to comment.