Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

204 rindas
5.8 KiB

  1. [tox]
  2. envlist = packaging, py37, py38, py39, py310, check_codestyle, check_isort
  3. # we require tox>=2.3.2 for the fix to https://github.com/tox-dev/tox/issues/208
  4. minversion = 2.3.2
  5. [base]
  6. deps =
  7. python-subunit
  8. junitxml
  9. coverage
  10. # this is pinned since it's a bit of an obscure package.
  11. coverage-enable-subprocess==1.0
  12. # cyptography 2.2 requires setuptools >= 18.5
  13. #
  14. # older versions of virtualenv (?) give us a virtualenv with the same
  15. # version of setuptools as is installed on the system python (and tox runs
  16. # virtualenv under python3, so we get the version of setuptools that is
  17. # installed on that).
  18. #
  19. # anyway, make sure that we have a recent enough setuptools.
  20. setuptools>=18.5
  21. # we also need a semi-recent version of pip, because old ones fail to
  22. # install the "enum34" dependency of cryptography.
  23. pip>=10
  24. # directories/files we run the linters on.
  25. # if you update this list, make sure to do the same in scripts-dev/lint.sh
  26. lint_targets =
  27. setup.py
  28. synapse
  29. tests
  30. scripts
  31. # annoyingly, black doesn't find these so we have to list them
  32. scripts/export_signing_key
  33. scripts/generate_config
  34. scripts/generate_log_config
  35. scripts/hash_password
  36. scripts/register_new_matrix_user
  37. scripts/synapse_port_db
  38. scripts/update_synapse_database
  39. scripts-dev
  40. scripts-dev/build_debian_packages
  41. scripts-dev/sign_json
  42. stubs
  43. contrib
  44. synctl
  45. synmark
  46. .ci
  47. docker
  48. # default settings for all tox environments
  49. [testenv]
  50. deps =
  51. {[base]deps}
  52. extras =
  53. # install the optional dependendencies for tox environments without
  54. # '-noextras' in their name
  55. # (this requires tox 3)
  56. !noextras: all
  57. test
  58. setenv =
  59. # use a postgres db for tox environments with "-postgres" in the name
  60. # (see https://tox.readthedocs.io/en/3.20.1/config.html#factors-and-factor-conditional-settings)
  61. postgres: SYNAPSE_POSTGRES = 1
  62. # this is used by .coveragerc to refer to the top of our tree.
  63. TOP={toxinidir}
  64. passenv = *
  65. commands =
  66. # the "env" invocation enables coverage checking for sub-processes. This is
  67. # particularly important when running trial with `-j`, since that will make
  68. # it run tests in a subprocess, whose coverage would otherwise not be
  69. # tracked. (It also makes an explicit `coverage run` command redundant.)
  70. #
  71. # (See https://coverage.readthedocs.io/en/coverage-5.3/subprocess.html.
  72. # Note that the `coverage.process_startup()` call is done by
  73. # `coverage-enable-subprocess`.)
  74. #
  75. # we use "env" rather than putting a value in `setenv` so that it is not
  76. # inherited by other tox environments.
  77. #
  78. /usr/bin/env COVERAGE_PROCESS_START={toxinidir}/.coveragerc "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  79. # As of twisted 16.4, trial tries to import the tests as a package (previously
  80. # it loaded the files explicitly), which means they need to be on the
  81. # pythonpath. Our sdist doesn't include the 'tests' package, so normally it
  82. # doesn't work within the tox virtualenv.
  83. #
  84. # As a workaround, we tell tox to do install with 'pip -e', which just
  85. # creates a symlink to the project directory instead of unpacking the sdist.
  86. #
  87. # (An alternative to this would be to set PYTHONPATH to include the project
  88. # directory. Note two problems with this:
  89. #
  90. # - if you set it via `setenv`, then it is also set during the 'install'
  91. # phase, which inhibits unpacking the sdist, so the virtualenv isn't
  92. # useful for anything else without setting PYTHONPATH similarly.
  93. #
  94. # - `synapse` is also loaded from PYTHONPATH so even if you only set
  95. # PYTHONPATH for the test phase, we're still running the tests against
  96. # the working copy rather than the contents of the sdist. So frankly
  97. # you might as well use -e in the first place.
  98. #
  99. # )
  100. usedevelop=true
  101. # A test suite for the oldest supported versions of Python libraries, to catch
  102. # any uses of APIs not available in them.
  103. [testenv:py3-old]
  104. skip_install = true
  105. usedevelop = false
  106. deps =
  107. Automat == 0.8.0
  108. lxml
  109. {[base]deps}
  110. commands =
  111. # Make all greater-thans equals so we test the oldest version of our direct
  112. # dependencies, but make the pyopenssl 17.0, which can work against an
  113. # OpenSSL 1.1 compiled cryptography (as older ones don't compile on Travis).
  114. /bin/sh -c 'python -m synapse.python_dependencies | sed -e "s/>=/==/g" -e "/psycopg2/d" -e "s/pyopenssl==16.0.0/pyopenssl==17.0.0/" | xargs -d"\n" pip install'
  115. # Install Synapse itself. This won't update any libraries.
  116. pip install -e ".[test]"
  117. {[testenv]commands}
  118. [testenv:benchmark]
  119. deps =
  120. {[base]deps}
  121. pyperf
  122. setenv =
  123. SYNAPSE_POSTGRES = 1
  124. commands =
  125. python -m synmark {posargs:}
  126. [testenv:packaging]
  127. skip_install = true
  128. usedevelop = false
  129. deps =
  130. check-manifest
  131. commands =
  132. check-manifest
  133. [testenv:check_codestyle]
  134. extras = lint
  135. commands =
  136. python -m black --check --diff {[base]lint_targets}
  137. flake8 {[base]lint_targets} {env:PEP8SUFFIX:}
  138. {toxinidir}/scripts-dev/config-lint.sh
  139. [testenv:check_isort]
  140. extras = lint
  141. commands = isort -c --df --sp setup.cfg {[base]lint_targets}
  142. [testenv:check-newsfragment]
  143. skip_install = true
  144. usedevelop = false
  145. deps = towncrier>=18.6.0rc1
  146. commands =
  147. python -m towncrier.check --compare-with=origin/develop
  148. [testenv:check-sampleconfig]
  149. commands = {toxinidir}/scripts-dev/generate_sample_config --check
  150. [testenv:combine]
  151. skip_install = true
  152. usedevelop = false
  153. deps =
  154. coverage
  155. pip>=10
  156. commands=
  157. coverage combine
  158. coverage report
  159. [testenv:cov-erase]
  160. skip_install = true
  161. usedevelop = false
  162. deps =
  163. coverage
  164. commands=
  165. coverage erase
  166. [testenv:cov-html]
  167. skip_install = true
  168. usedevelop = false
  169. deps =
  170. coverage
  171. commands=
  172. coverage html
  173. [testenv:mypy]
  174. deps =
  175. {[base]deps}
  176. extras = all,mypy
  177. commands = mypy