Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

180 строки
4.9 KiB

  1. [tox]
  2. envlist = packaging, py35, py36, py37, py38, check_codestyle, check_isort
  3. [base]
  4. deps =
  5. mock
  6. python-subunit
  7. junitxml
  8. coverage
  9. coverage-enable-subprocess
  10. parameterized
  11. # cyptography 2.2 requires setuptools >= 18.5
  12. #
  13. # older versions of virtualenv (?) give us a virtualenv with the same
  14. # version of setuptools as is installed on the system python (and tox runs
  15. # virtualenv under python3, so we get the version of setuptools that is
  16. # installed on that).
  17. #
  18. # anyway, make sure that we have a recent enough setuptools.
  19. setuptools>=18.5
  20. # we also need a semi-recent version of pip, because old ones fail to
  21. # install the "enum34" dependency of cryptography.
  22. pip>=10
  23. setenv =
  24. # we have a pyproject.toml, but don't want pip to use it for building.
  25. # (otherwise we get an error about 'editable mode is not supported for
  26. # pyproject.toml-style projects').
  27. PIP_USE_PEP517 = false
  28. PYTHONDONTWRITEBYTECODE = no_byte_code
  29. COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
  30. [testenv]
  31. deps =
  32. {[base]deps}
  33. extras = all
  34. whitelist_externals =
  35. sh
  36. setenv =
  37. {[base]setenv}
  38. postgres: SYNAPSE_POSTGRES = 1
  39. TOP={toxinidir}
  40. passenv = *
  41. commands =
  42. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  43. # Add this so that coverage will run on subprocesses
  44. {envbindir}/coverage run "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  45. # As of twisted 16.4, trial tries to import the tests as a package (previously
  46. # it loaded the files explicitly), which means they need to be on the
  47. # pythonpath. Our sdist doesn't include the 'tests' package, so normally it
  48. # doesn't work within the tox virtualenv.
  49. #
  50. # As a workaround, we tell tox to do install with 'pip -e', which just
  51. # creates a symlink to the project directory instead of unpacking the sdist.
  52. #
  53. # (An alternative to this would be to set PYTHONPATH to include the project
  54. # directory. Note two problems with this:
  55. #
  56. # - if you set it via `setenv`, then it is also set during the 'install'
  57. # phase, which inhibits unpacking the sdist, so the virtualenv isn't
  58. # useful for anything else without setting PYTHONPATH similarly.
  59. #
  60. # - `synapse` is also loaded from PYTHONPATH so even if you only set
  61. # PYTHONPATH for the test phase, we're still running the tests against
  62. # the working copy rather than the contents of the sdist. So frankly
  63. # you might as well use -e in the first place.
  64. #
  65. # )
  66. usedevelop=true
  67. # A test suite for the oldest supported versions of Python libraries, to catch
  68. # any uses of APIs not available in them.
  69. [testenv:py35-old]
  70. skip_install=True
  71. deps =
  72. # Old automat version for Twisted
  73. Automat == 0.3.0
  74. mock
  75. lxml
  76. coverage
  77. coverage-enable-subprocess
  78. commands =
  79. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  80. # Make all greater-thans equals so we test the oldest version of our direct
  81. # dependencies, but make the pyopenssl 17.0, which can work against an
  82. # OpenSSL 1.1 compiled cryptography (as older ones don't compile on Travis).
  83. /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 -d"\n" pip install'
  84. # Install Synapse itself. This won't update any libraries.
  85. pip install -e .
  86. {envbindir}/coverage run "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  87. [testenv:benchmark]
  88. deps =
  89. {[base]deps}
  90. pyperf
  91. setenv =
  92. SYNAPSE_POSTGRES = 1
  93. commands =
  94. python -m synmark {posargs:}
  95. [testenv:packaging]
  96. skip_install=True
  97. deps =
  98. check-manifest
  99. commands =
  100. check-manifest
  101. [testenv:check_codestyle]
  102. skip_install = True
  103. deps =
  104. flake8
  105. flake8-comprehensions
  106. # We pin so that our tests don't start failing on new releases of black.
  107. black==19.10b0
  108. commands =
  109. python -m black --check --diff .
  110. /bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
  111. {toxinidir}/scripts-dev/config-lint.sh
  112. [testenv:check_isort]
  113. skip_install = True
  114. deps = isort==5.0.3
  115. commands = /bin/sh -c "isort -c --df --sp setup.cfg synapse tests scripts-dev scripts"
  116. [testenv:check-newsfragment]
  117. skip_install = True
  118. deps = towncrier>=18.6.0rc1
  119. commands =
  120. python -m towncrier.check --compare-with=origin/develop
  121. [testenv:check-sampleconfig]
  122. commands = {toxinidir}/scripts-dev/generate_sample_config --check
  123. [testenv:combine]
  124. skip_install = True
  125. deps =
  126. coverage
  127. commands=
  128. coverage combine
  129. coverage report
  130. [testenv:cov-erase]
  131. skip_install = True
  132. deps =
  133. coverage
  134. commands=
  135. coverage erase
  136. [testenv:cov-html]
  137. skip_install = True
  138. deps =
  139. coverage
  140. commands=
  141. coverage html
  142. [testenv:mypy]
  143. skip_install = True
  144. deps =
  145. {[base]deps}
  146. mypy==0.782
  147. mypy-zope
  148. extras = all
  149. commands = mypy
  150. # To find all folders that pass mypy you run:
  151. #
  152. # find synapse/* -type d -not -name __pycache__ -exec bash -c "mypy '{}' > /dev/null" \; -print