Skip to content

Commit

Permalink
Introduce nox for matrix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jarus committed May 7, 2019
1 parent 92a8332 commit b230de0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -32,6 +32,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.cache
nosetests.xml
Expand Down
37 changes: 37 additions & 0 deletions noxfile.py
@@ -0,0 +1,37 @@
import os
from urllib.parse import urlparse

import nox

PIP_INDEX_URL = os.environ.get('NOX_PIP_INDEX_URL', None)


@nox.session(python=['2.7', '3.4', '3.6', '3.7'], reuse_venv=True)
@nox.parametrize('sqlalchemy', ['1.0', '1.1', '1.2', '1.3'])
@nox.parametrize('hana_driver', ['hdbcli', 'pyhdb'])
def test(session, sqlalchemy, hana_driver):
if 'NOX_SAP_HANA_URI' not in os.environ:
session.skip(
"Environment variable NOX_SAP_HANA_URI must be defined. "
"Example: NOX_SAP_HANA_URI=USERNAME:PASSWORD@sap-hana-host:PORT"
)

pip_env = {}
if PIP_INDEX_URL:
session.log('Use and trust custom index url from NOX_PIP_INDEX_URL')
pip_env = {
'PIP_INDEX_URL': PIP_INDEX_URL,
'PIP_TRUSTED_HOST': urlparse(PIP_INDEX_URL).netloc
}

session.install('sqlalchemy~={}.0'.format(sqlalchemy))
session.install(hana_driver, env=pip_env)
session.install('.[test]')

dburi = 'hana+' + hana_driver + '://' + os.environ['NOX_SAP_HANA_URI']
session.run(
'pytest',
'--dburi', dburi,
'--requirements', 'sqlalchemy_hana.requirements:Requirements',
*session.posargs
)

0 comments on commit b230de0

Please sign in to comment.