tox.ini 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. [tox]
  2. envlist = packaging, py27, py36, pep8
  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/metrics tests/config} \
  48. {env:TOXSUFFIX:}
  49. {env:DUMP_COVERAGE_COMMAND:coverage report -m}
  50. [testenv:packaging]
  51. deps =
  52. check-manifest
  53. commands =
  54. check-manifest
  55. [testenv:pep8]
  56. skip_install = True
  57. basepython = python2.7
  58. deps =
  59. flake8
  60. commands = /bin/sh -c "flake8 synapse tests {env:PEP8SUFFIX:}"