diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..b6f7d573 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/setup.py b/setup.py index 45f8b276..f8e94319 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_basic_app.py b/tests/test_basic_app.py index aae00cb6..4270c58c 100644 --- a/tests/test_basic_app.py +++ b/tests/test_basic_app.py @@ -1,3 +1,5 @@ + +import warnings import flask import flask_sqlalchemy as fsa @@ -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