tox.ini 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. [tox]
  2. envlist = packaging, py27, py36, pep8, check_isort
  3. [testenv]
  4. deps =
  5. coverage
  6. Twisted>=15.1
  7. mock
  8. python-subunit
  9. junitxml
  10. # needed by some of the tests
  11. lxml
  12. setenv =
  13. PYTHONDONTWRITEBYTECODE = no_byte_code
  14. commands =
  15. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  16. coverage run {env:COVERAGE_OPTS:} --source="{toxinidir}/synapse" \
  17. "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
  18. {env:DUMP_COVERAGE_COMMAND:coverage report -m}
  19. [testenv:py27]
  20. # As of twisted 16.4, trial tries to import the tests as a package (previously
  21. # it loaded the files explicitly), which means they need to be on the
  22. # pythonpath. Our sdist doesn't include the 'tests' package, so normally it
  23. # doesn't work within the tox virtualenv.
  24. #
  25. # As a workaround, we tell tox to do install with 'pip -e', which just
  26. # creates a symlink to the project directory instead of unpacking the sdist.
  27. #
  28. # (An alternative to this would be to set PYTHONPATH to include the project
  29. # directory. Note two problems with this:
  30. #
  31. # - if you set it via `setenv`, then it is also set during the 'install'
  32. # phase, which inhibits unpacking the sdist, so the virtualenv isn't
  33. # useful for anything else without setting PYTHONPATH similarly.
  34. #
  35. # - `synapse` is also loaded from PYTHONPATH so even if you only set
  36. # PYTHONPATH for the test phase, we're still running the tests against
  37. # the working copy rather than the contents of the sdist. So frankly
  38. # you might as well use -e in the first place.
  39. #
  40. # )
  41. usedevelop=true
  42. [testenv:py36]
  43. usedevelop=true
  44. commands =
  45. /usr/bin/find "{toxinidir}" -name '*.pyc' -delete
  46. coverage run {env:COVERAGE_OPTS:} --source="{toxinidir}/synapse" \
  47. "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests/config \
  48. tests/api/test_filtering.py \
  49. tests/api/test_ratelimiting.py \
  50. tests/appservice \
  51. tests/crypto \
  52. tests/events \
  53. tests/handlers/test_appservice.py \
  54. tests/handlers/test_auth.py \
  55. tests/handlers/test_device.py \
  56. tests/handlers/test_directory.py \
  57. tests/handlers/test_e2e_keys.py \
  58. tests/handlers/test_presence.py \
  59. tests/handlers/test_profile.py \
  60. tests/handlers/test_register.py \
  61. tests/replication/slave/storage/test_account_data.py \
  62. tests/replication/slave/storage/test_receipts.py \
  63. tests/storage/test_appservice.py \
  64. tests/storage/test_background_update.py \
  65. tests/storage/test_base.py \
  66. tests/storage/test__base.py \
  67. tests/storage/test_client_ips.py \
  68. tests/storage/test_devices.py \
  69. tests/storage/test_end_to_end_keys.py \
  70. tests/storage/test_event_push_actions.py \
  71. tests/storage/test_keys.py \
  72. tests/storage/test_presence.py \
  73. tests/storage/test_profile.py \
  74. tests/storage/test_registration.py \
  75. tests/storage/test_room.py \
  76. tests/storage/test_user_directory.py \
  77. tests/test_distributor.py \
  78. tests/test_dns.py \
  79. tests/test_preview.py \
  80. tests/test_test_utils.py \
  81. tests/test_types.py \
  82. tests/util} \
  83. {env:TOXSUFFIX:}
  84. {env:DUMP_COVERAGE_COMMAND:coverage report -m}
  85. [testenv:packaging]
  86. deps =
  87. check-manifest
  88. commands =
  89. check-manifest
  90. [testenv:pep8]
  91. skip_install = True
  92. basepython = python2.7
  93. deps =
  94. flake8
  95. commands = /bin/sh -c "flake8 synapse tests {env:PEP8SUFFIX:}"
  96. [testenv:check_isort]
  97. skip_install = True
  98. deps = isort
  99. commands = /bin/sh -c "isort -c -sp setup.cfg -rc synapse tests"
  100. [testenv:check-newsfragment]
  101. skip_install = True
  102. deps = towncrier>=18.6.0rc1
  103. commands =
  104. python -m towncrier.check --compare-with=origin/develop
  105. basepython = python3.6