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 pytest for unit testing #103

Merged
merged 14 commits into from
Feb 14, 2021
20 changes: 13 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ orbs:
azure-cli: circleci/azure-cli@1.1.0

jobs:
unit:
docker:
- image: dataders/pyodbc:1.4
steps:
- checkout
- run: tox -e unit
integration-sqlserver: &sqlserver
docker:
docker:
- image: dataders/pyodbc:1.4
- image: mcr.microsoft.com/mssql/server:2019-latest
environment:
ACCEPT_EULA: 'yes'
MSSQL_SA_PASSWORD: 5atyaNadella
MSSQL_IP_ADDRESS: 0.0.0.0
executor: python/default
executor: python/default
steps:
- run: &install-git
name: "TEMP: install Git"
Expand Down Expand Up @@ -70,11 +76,10 @@ jobs:
# command: |
# cd test/integration
# dbt compile --target azuresql_aad

integration-azuresql:
docker:
docker:
- image: dataders/pyodbc:1.4
executor: python/default
executor: python/default
steps:
- run: *install-git
- checkout
Expand All @@ -89,9 +94,9 @@ jobs:
name: Test adapter on Azure SQL against dbt-adapter-tests
command: tox -e integration-azuresql
connection-azuresql:
docker:
docker:
- image: dataders/pyodbc:1.4
executor: python/default
executor: python/default
steps:
- run: *install-git
- checkout
Expand Down Expand Up @@ -130,6 +135,7 @@ jobs:
workflows:
main:
jobs:
- unit
- connection-azuresql:
context:
- DBT_SYNAPSE_PROFILE
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#### Under the hood:
- This adapter has separate CI tests to ensure all the connection methods are working as they should [#75](https://github.com/dbt-msft/dbt-sqlserver/pull/75)
- This adapter has a CI job for running unit tests [#103](https://github.com/dbt-msft/dbt-sqlserver/pull/103)

### v0.18.1
#### New Features:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ Example of applying Unique clustered index on two columns, Ordinary index on one

## Changelog

See [the changelog](CHANGELOG.md)
See [the changelog](CHANGELOG.md)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ pyodbc>=4.0.27
azure-identity>=1.4.0
black~=20.8b1
pytest-dbt-adapter~=0.4.0
pytest>=6.2.0
tox==3.2.0
flake8>=3.5.0
certifi==2020.6.20
.
.
3 changes: 3 additions & 0 deletions test/unit/adapters/sqlserver/test_connections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def test_dummy():
"""Dummy test to see if unit tests are working."""
assert True
12 changes: 8 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ envlist = unit, flake8, integration-sqlserver, integration-synapse
basepython = python3
commands = /bin/bash -c '{envpython} -m pytest -v test/integration/sqlserver.dbtspec'
deps =
-r{toxinidir}/requirements.txt
-e.
-r {toxinidir}/requirements.txt

[testenv:integration-azuresql]
basepython = python3
commands = /bin/bash -c '{envpython} -m pytest -v test/integration/azuresql.dbtspec'
passenv = DBT_AZURESQL_DB DBT_AZURESQL_PWD DBT_AZURESQL_SERVER DBT_AZURESQL_UID
deps =
-r{toxinidir}/requirements.txt
-e.
JCZuurmond marked this conversation as resolved.
Show resolved Hide resolved
-r {toxinidir}/requirements.txt

[testenv:unit]
basepython = python3
commands = /bin/bash -c '{envpython} -m pytest test/unit'
deps =
-r {toxinidir}/requirements.txt