diff --git a/.circleci/config.yml b/.circleci/config.yml index 030046ed..fb2e77aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ jobs: - image: dataders/pyodbc:1.4 steps: - checkout - - run: tox -e unit + - run: tox -- -v test/unit integration-sqlserver: &sqlserver docker: - image: dataders/pyodbc:1.4 @@ -19,12 +19,15 @@ jobs: ACCEPT_EULA: 'yes' MSSQL_SA_PASSWORD: 5atyaNadella MSSQL_IP_ADDRESS: 0.0.0.0 - executor: python/default steps: - run: &install-git name: "TEMP: install Git" command: | apt-get install -y git + - run: &upgrade-dbt + name: "TEMP: upgrade dbt" # hot fix: dbt is installed in the pyodbc docker image, it should be removed there + command: | + pip install --upgrade dbt - checkout - run: name: wait for SQL Server container to set up @@ -32,18 +35,18 @@ jobs: - run: name: test connection via SQL CMD command: sqlcmd -S 'localhost,1433' -U sa -P 5atyaNadella -Q 'create database blog' - - python/install-packages: - pkg-manager: pip - run: name: Test adapter on SQL Server against dbt-adapter-tests - command: tox -e integration-sqlserver + command: tox -- -v test/integration/sqlserver.dbtspec connection-sqlserver: <<: *sqlserver steps: - run: *install-git + - run: *upgrade-dbt - checkout - - python/install-packages: - pkg-manager: pip + - run: &install-dbt-sqlserver + name: "install dbt-sqlserver" + command: python setup.py install - run: name: wait for SQL Server container to set up command: sleep 30 @@ -51,8 +54,7 @@ jobs: name: prep for connecting command: | mkdir -p ~/.dbt - cd test/integration - cp sample.profiles.yml ~/.dbt/profiles.yml + cp test/integration/sample.profiles.yml ~/.dbt/profiles.yml - run: name: cnxn -- SQL Server - local sql cred command: | @@ -63,28 +65,15 @@ jobs: command: | cd test/integration dbt compile --target sqlserver_local_encrypt - - run: - name: cnxn -- Azure SQL - SQL cred - command: | - cd test/integration - dbt compile --target azuresql_sqlcred - # TODO drop support for this method in favor of - # https://github.com/dbt-msft/dbt-sqlserver/pull/71 - # - run: - # name: cnxn -- Azure SQL - AAD Password - # command: | - # cd test/integration - # dbt compile --target azuresql_aad integration-azuresql: docker: - image: dataders/pyodbc:1.4 - executor: python/default steps: - run: *install-git + - run: *upgrade-dbt - checkout - - python/install-packages: - pkg-manager: pip + - run: *install-dbt-sqlserver - run: name: wake up serverless db command: | @@ -92,16 +81,15 @@ jobs: dbt debug --target azuresql_sqlcred - run: name: Test adapter on Azure SQL against dbt-adapter-tests - command: tox -e integration-azuresql + command: tox -- -v test/integration/azuresql.dbtspec connection-azuresql: docker: - image: dataders/pyodbc:1.4 - executor: python/default steps: - run: *install-git + - run: *upgrade-dbt - checkout - - python/install-packages: - pkg-manager: pip + - run: *install-dbt-sqlserver - run: name: install gnupg command: apt-get install gnupg -y diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8157d7..3a44001f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,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) +- Update the tox setup [#105](https://github.com/dbt-msft/dbt-sqlserver/pull/105) ### v0.18.1 #### New Features: diff --git a/dev_requirements.txt b/dev_requirements.txt new file mode 100644 index 00000000..34409954 --- /dev/null +++ b/dev_requirements.txt @@ -0,0 +1,5 @@ +black==20.8b1 +pytest-dbt-adapter==0.4.0 +pytest==6.2.2 +tox==3.2.0 +flake8==3.5.0 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 22613703..00000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -dbt-core==0.19.0 -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 -. diff --git a/setup.py b/setup.py index 68ba819a..3b5e7560 100644 --- a/setup.py +++ b/setup.py @@ -57,8 +57,8 @@ def _dbt_sqlserver_version(): ] }, install_requires=[ - 'dbt-core~=0.19.0', + "dbt-core~=0.19.0", "pyodbc>=4.0.27", "azure-identity>=1.4.0", ] -) \ No newline at end of file +) diff --git a/tox.ini b/tox.ini index b449562b..7100edd5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,22 +1,13 @@ [tox] -skipsdist = True -envlist = unit, flake8, integration-sqlserver, integration-synapse +envlist = py37 -[testenv:integration-sqlserver] -basepython = python3 -commands = /bin/bash -c '{envpython} -m pytest -v test/integration/sqlserver.dbtspec' +[testenv] +commands = pytest {posargs} +passenv = + DBT_AZURESQL_DB + DBT_AZURESQL_SERVER + DBT_AZURESQL_PWD + DBT_AZURESQL_UID deps = - -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 - -[testenv:unit] -basepython = python3 -commands = /bin/bash -c '{envpython} -m pytest test/unit' -deps = - -r {toxinidir}/requirements.txt + pytest~=6.2.2 + pytest-dbt-adapter~=0.4.0