tox.ini 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. [tox]
  2. envlist = packaging, py27, py36, pep8, check_isort
  3. [base]
  4. deps =
  5. coverage
  6. Twisted>=17.1
  7. mock
  8. python-subunit
  9. junitxml
  10. # needed by some of the tests
  11. lxml
  12. setenv =
  13. PYTHONDONTWRITEBYTECODE = no_byte_code
  14. [testenv]
  15. deps =
  16. {[base]deps}
  17. setenv =
  18. {[base]setenv}
  19. passenv = *
  20. commands =
  21. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  22. coverage run {env:COVERAGE_OPTS:} --source="{toxinidir}/synapse" \
  23. "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  24. {env:DUMP_COVERAGE_COMMAND:coverage report -m}
  25. [testenv:py27]
  26. # As of twisted 16.4, trial tries to import the tests as a package (previously
  27. # it loaded the files explicitly), which means they need to be on the
  28. # pythonpath. Our sdist doesn't include the 'tests' package, so normally it
  29. # doesn't work within the tox virtualenv.
  30. #
  31. # As a workaround, we tell tox to do install with 'pip -e', which just
  32. # creates a symlink to the project directory instead of unpacking the sdist.
  33. #
  34. # (An alternative to this would be to set PYTHONPATH to include the project
  35. # directory. Note two problems with this:
  36. #
  37. # - if you set it via `setenv`, then it is also set during the 'install'
  38. # phase, which inhibits unpacking the sdist, so the virtualenv isn't
  39. # useful for anything else without setting PYTHONPATH similarly.
  40. #
  41. # - `synapse` is also loaded from PYTHONPATH so even if you only set
  42. # PYTHONPATH for the test phase, we're still running the tests against
  43. # the working copy rather than the contents of the sdist. So frankly
  44. # you might as well use -e in the first place.
  45. #
  46. # )
  47. usedevelop=true
  48. [testenv:py27-postgres]
  49. usedevelop=true
  50. deps =
  51. {[base]deps}
  52. psycopg2
  53. setenv =
  54. {[base]setenv}
  55. SYNAPSE_POSTGRES = 1
  56. # A test suite for the oldest supported versions of Python libraries, to catch
  57. # any uses of APIs not available in them.
  58. [testenv:py27-old]
  59. skip_install=True
  60. deps =
  61. # Old automat version for Twisted
  62. Automat == 0.3.0
  63. mock
  64. lxml
  65. commands =
  66. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  67. # Make all greater-thans equals so we test the oldest version of our direct
  68. # dependencies, but make the pyopenssl 17.0, which can work against an
  69. # OpenSSL 1.1 compiled cryptography (as older ones don't compile on Travis).
  70. /bin/sh -c 'python -m synapse.python_dependencies | sed -e "s/>=/==/g" -e "s/psycopg2==2.6//" -e "s/pyopenssl==16.0.0/pyopenssl==17.0.0/" | xargs pip install'
  71. # Install Synapse itself. This won't update any libraries.
  72. pip install -e .
  73. {envbindir}/trial {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  74. [testenv:py35]
  75. usedevelop=true
  76. [testenv:py36]
  77. usedevelop=true
  78. [testenv:py36-postgres]
  79. usedevelop=true
  80. deps =
  81. {[base]deps}
  82. psycopg2
  83. setenv =
  84. {[base]setenv}
  85. SYNAPSE_POSTGRES = 1
  86. [testenv:packaging]
  87. deps =
  88. check-manifest
  89. commands =
  90. check-manifest
  91. [testenv:pep8]
  92. skip_install = True
  93. basepython = python2.7
  94. deps =
  95. flake8
  96. commands = /bin/sh -c "flake8 synapse tests {env:PEP8SUFFIX:}"
  97. [testenv:check_isort]
  98. skip_install = True
  99. deps = isort
  100. commands = /bin/sh -c "isort -c -sp setup.cfg -rc synapse tests"
  101. [testenv:check-newsfragment]
  102. skip_install = True
  103. deps = towncrier>=18.6.0rc1
  104. commands =
  105. python -m towncrier.check --compare-with=origin/develop
  106. basepython = python3.6