tox.ini 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [tox]
  2. envlist = py{27,34,35,36,37,38}-{cext,nocext}
  3. [testenv]
  4. # note that we have a .coveragerc file that points coverage specifically
  5. # at ./lib/sqlalchemy, and *not* at the build that tox might create under .tox.
  6. # See the notes below for setenv for more detail.
  7. # also using --cov-append so that we can aggregate multiple runs together.
  8. # Jenkins etc. need to call "coverage erase" externally.
  9. cov_args=--cov=sqlalchemy --cov-report term --cov-append --cov-report xml --exclude-tag memory-intensive --exclude-tag timing-intensive -k "not aaa_profiling"
  10. install_command=python -m pip install {env:TOX_PIP_OPTS:} {opts} {packages}
  11. usedevelop=
  12. cov: True
  13. deps=pytest!=3.9.1,!=3.9.2
  14. pytest-xdist
  15. mock; python_version < '3.3'
  16. # needed only for correct profiling results
  17. # due to speed improvements in psycopg2 as of 2.7
  18. postgresql: psycopg2>=2.7
  19. # needed only for correct profiling results
  20. # due to speed improvements in mysqlclient as of 1.4.0
  21. mysql: mysqlclient>=1.4.0
  22. mysql: pymysql
  23. mysql: mysql-connector-python
  24. # waiting for https://github.com/oracle/python-cx_Oracle/issues/75
  25. oracle: cx_oracle>=7.0
  26. oracle6: cx_oracle>=6.0.2,!=6.3,!=6.4,<7.0
  27. oracle5: cx_oracle==5.2.1
  28. mssql: pyodbc
  29. cov: pytest-cov
  30. whitelist_externals=sh
  31. # PYTHONPATH - erased so that we use the build that's present
  32. # in .tox as the SQLAlchemy library to be imported
  33. #
  34. # PYTHONUSERSITE - this *MUST* be set so that the ./lib/ import
  35. # set up explicitly in test/conftest.py is *disabled*, again so that
  36. # when SQLAlchemy is built into the .tox area, we use that and not the
  37. # local checkout, at least when usedevelop=False
  38. #
  39. # BASECOMMAND - using an env variable here so we can use it
  40. # as a substitution in a command (see https://bitbucket.org/hpk42/tox/issues/307/)
  41. #
  42. # only use --dropfirst option if we're *not* using -n;
  43. # if -n is used, we're working in brand new DBs anyway, dropfirst
  44. # will collide on CI environments
  45. setenv=
  46. PYTHONPATH=
  47. PYTHONNOUSERSITE=1
  48. BASECOMMAND=python -m pytest --log-info=sqlalchemy.testing
  49. WORKERS={env:TOX_WORKERS:-n4 --max-worker-restart=5}
  50. oracle,oracle6,oracle5: WORKERS={env:TOX_WORKERS:-n2 --max-worker-restart=5}
  51. nocext: DISABLE_SQLALCHEMY_CEXT=1
  52. cov: COVERAGE={[testenv]cov_args}
  53. sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
  54. sqlite_file: SQLITE={env:TOX_SQLITE_FILE:--db sqlite_file}
  55. postgresql: POSTGRESQL={env:TOX_POSTGRESQL:--db postgresql}
  56. mysql: MYSQL={env:TOX_MYSQL:--db mysql --db pymysql}
  57. oracle,oracle6,oracle5: ORACLE={env:TOX_ORACLE:--db oracle}
  58. mssql: MSSQL={env:TOX_MSSQL:--db mssql}
  59. oracle,oracle6,oracle5,mssql,sqlite_file: IDENTS=--write-idents db_idents.txt
  60. oracle,oracle6,oracle5,mssql,sqlite_file: NOMEMORY=--nomemory
  61. backendonly: BACKENDONLY=--backend-only
  62. # tox as of 2.0 blocks all environment variables from the
  63. # outside, unless they are here (or in TOX_TESTENV_PASSENV,
  64. # wildcards OK). Need at least these
  65. passenv=ORACLE_HOME NLS_LANG TOX_POSTGRESQL TOX_MYSQL TOX_ORACLE TOX_MSSQL TOX_SQLITE TOX_SQLITE_FILE TOX_WORKERS
  66. # for nocext, we rm *.so in lib in case we are doing usedevelop=True
  67. commands=
  68. nocext: sh -c "rm -f lib/sqlalchemy/*.so"
  69. {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
  70. oracle,oracle6,oracle5,mssql,sqlite_file: python reap_dbs.py db_idents.txt
  71. # thanks to https://julien.danjou.info/the-best-flake8-extensions/
  72. [testenv:pep8]
  73. basepython = python3.7
  74. deps=
  75. flake8
  76. flake8-import-order
  77. flake8-builtins
  78. flake8-docstrings
  79. flake8-rst-docstrings
  80. pydocstyle<4.0.0
  81. # used by flake8-rst-docstrings
  82. pygments
  83. commands = flake8 ./lib/ ./test/ ./examples/ setup.py
  84. # command run in the github action when cext are active.
  85. [testenv:github-cext]
  86. commands=
  87. python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
  88. oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt
  89. # command run in the github action when cext are not active.
  90. [testenv:github-nocext]
  91. commands=
  92. python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
  93. oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt