1
0

tox.ini 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. [tox]
  2. envlist = py37, py38, py39, py310
  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. # the tox-venv plugin makes tox use python's built-in `venv` module rather than
  6. # the legacy `virtualenv` tool. `virtualenv` embeds its own `pip`, `setuptools`,
  7. # etc, and ends up being rather unreliable.
  8. requires = tox-venv
  9. [base]
  10. deps =
  11. python-subunit
  12. junitxml
  13. coverage
  14. # this is pinned since it's a bit of an obscure package.
  15. coverage-enable-subprocess==1.0
  16. # cyptography 2.2 requires setuptools >= 18.5
  17. #
  18. # older versions of virtualenv (?) give us a virtualenv with the same
  19. # version of setuptools as is installed on the system python (and tox runs
  20. # virtualenv under python3, so we get the version of setuptools that is
  21. # installed on that).
  22. #
  23. # anyway, make sure that we have a recent enough setuptools.
  24. setuptools>=18.5
  25. # we also need a semi-recent version of pip, because old ones fail to
  26. # install the "enum34" dependency of cryptography.
  27. pip>=10
  28. # default settings for all tox environments
  29. [testenv]
  30. deps =
  31. {[base]deps}
  32. extras =
  33. # install the optional dependendencies for tox environments without
  34. # '-noextras' in their name
  35. # (this requires tox 3)
  36. !noextras: all
  37. test
  38. setenv =
  39. # use a postgres db for tox environments with "-postgres" in the name
  40. # (see https://tox.readthedocs.io/en/3.20.1/config.html#factors-and-factor-conditional-settings)
  41. postgres: SYNAPSE_POSTGRES = 1
  42. # this is used by .coveragerc to refer to the top of our tree.
  43. TOP={toxinidir}
  44. passenv = *
  45. commands =
  46. # the "env" invocation enables coverage checking for sub-processes. This is
  47. # particularly important when running trial with `-j`, since that will make
  48. # it run tests in a subprocess, whose coverage would otherwise not be
  49. # tracked. (It also makes an explicit `coverage run` command redundant.)
  50. #
  51. # (See https://coverage.readthedocs.io/en/coverage-5.3/subprocess.html.
  52. # Note that the `coverage.process_startup()` call is done by
  53. # `coverage-enable-subprocess`.)
  54. #
  55. # we use "env" rather than putting a value in `setenv` so that it is not
  56. # inherited by other tox environments.
  57. #
  58. /usr/bin/env COVERAGE_PROCESS_START={toxinidir}/.coveragerc "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  59. # As of twisted 16.4, trial tries to import the tests as a package (previously
  60. # it loaded the files explicitly), which means they need to be on the
  61. # pythonpath. Our sdist doesn't include the 'tests' package, so normally it
  62. # doesn't work within the tox virtualenv.
  63. #
  64. # As a workaround, we tell tox to do install with 'pip -e', which just
  65. # creates a symlink to the project directory instead of unpacking the sdist.
  66. #
  67. # (An alternative to this would be to set PYTHONPATH to include the project
  68. # directory. Note two problems with this:
  69. #
  70. # - if you set it via `setenv`, then it is also set during the 'install'
  71. # phase, which inhibits unpacking the sdist, so the virtualenv isn't
  72. # useful for anything else without setting PYTHONPATH similarly.
  73. #
  74. # - `synapse` is also loaded from PYTHONPATH so even if you only set
  75. # PYTHONPATH for the test phase, we're still running the tests against
  76. # the working copy rather than the contents of the sdist. So frankly
  77. # you might as well use -e in the first place.
  78. #
  79. # )
  80. usedevelop=true
  81. [testenv:benchmark]
  82. deps =
  83. {[base]deps}
  84. pyperf
  85. setenv =
  86. SYNAPSE_POSTGRES = 1
  87. commands =
  88. python -m synmark {posargs:}