tox.ini 3.7 KB

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