tox.ini 3.2 KB

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