Skip to content

Commit

Permalink
SNOW-1058245-sqlalchemy-20-support: action for testing with SQLAlchem…
Browse files Browse the repository at this point in the history
…y v2 library
  • Loading branch information
sfc-gh-mraba committed Feb 16, 2024
1 parent 2b68c27 commit 27ac7ac
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,58 @@ jobs:
path: |
.tox/.coverage
.tox/coverage.xml
test_sqlalchemy_v2:
name: SQLAlchemy v2 test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
needs: lint
runs-on: ${{ matrix.os.image_name }}
strategy:
fail-fast: false
matrix:
os:
- image_name: ubuntu-latest
download_name: manylinux_x86_64
- image_name: macos-latest
download_name: macosx_x86_64
- image_name: windows-2019
download_name: win_amd64
python-version: ["3.8"]
cloud-provider: [aws, azure, gcp]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Setup parameters file
shell: bash
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
run: |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py
- name: Upgrade setuptools, pip and wheel
run: python -m pip install -U setuptools pip wheel
- name: Install tox
run: python -m pip install tox
- name: List installed packages
run: python -m pip freeze
- name: Run tests
run: python -m tox -e "py${PYTHON_VERSION/\./}-sqlalchemy-v2"
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PYTEST_ADDOPTS: -vvv --color=yes --tb=short
- name: Combine coverages
run: python -m tox -e coverage --skip-missing-interpreters false
shell: bash
- uses: actions/upload-artifact@v2
with:
name: coverage_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
path: |
.tox/.coverage
.tox/coverage.xml
combine-coverage:
if: ${{ success() || failure() }}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = ["snowflake-connector-python", "sqlalchemy<2.1.0,>=1.4.0"]
dependencies = ["snowflake-connector-python", "sqlalchemy<2.0.0,>=1.4.0"]

[project.optional-dependencies]
development = [
Expand Down
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
min_version = 4.0.0
envlist = fix_lint,
py{37,38,39,310,311}{,-pandas},
py{38}-sqlalchemy-v2
coverage,
skip_missing_interpreters = true

Expand Down Expand Up @@ -85,6 +86,14 @@ skip_install = True
commands = pre-commit run --all-files
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'

[testenv:py{38}-sqlalchemy-v2]
base_python = py38
commands =
pip install -U sqlalchemy
pip list
pytest --run_v20_sqlalchemy {posargs:tests}
pytest tests/test_core.py {posargs:tests}

[pytest]
addopts = -ra --strict-markers --ignore=tests/sqlalchemy_test_suite
junit_family = legacy
Expand Down

0 comments on commit 27ac7ac

Please sign in to comment.