1
0

tox.ini 3.5 KB

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