PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/zc.recipe.egg_/src/zc/recipe/egg/tests.py

https://github.com/koodaamo/buildout
Python | 113 lines | 97 code | 3 blank | 13 comment | 1 complexity | 5c102a8975d502c638c10ddfea32c528 MD5 | raw file
Possible License(s): GPL-2.0
  1. ##############################################################################
  2. #
  3. # Copyright (c) 2006 Zope Foundation and Contributors.
  4. # All Rights Reserved.
  5. #
  6. # This software is subject to the provisions of the Zope Public License,
  7. # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
  8. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
  9. # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  10. # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
  11. # FOR A PARTICULAR PURPOSE.
  12. #
  13. ##############################################################################
  14. from zope.testing import renormalizing
  15. import doctest
  16. import os
  17. import re
  18. import shutil
  19. import sys
  20. import zc.buildout.tests
  21. import zc.buildout.testing
  22. import unittest
  23. os_path_sep = os.path.sep
  24. if os_path_sep == '\\':
  25. os_path_sep *= 2
  26. def dirname(d, level=1):
  27. if level == 0:
  28. return d
  29. return dirname(os.path.dirname(d), level-1)
  30. def setUp(test):
  31. zc.buildout.tests.easy_install_SetUp(test)
  32. zc.buildout.testing.install_develop('zc.recipe.egg', test)
  33. def test_suite():
  34. suite = unittest.TestSuite((
  35. doctest.DocFileSuite(
  36. 'README.txt',
  37. setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
  38. checker=renormalizing.RENormalizing([
  39. zc.buildout.testing.normalize_path,
  40. zc.buildout.testing.normalize_endings,
  41. zc.buildout.testing.normalize_script,
  42. zc.buildout.testing.normalize_egg_py,
  43. zc.buildout.tests.normalize_bang,
  44. zc.buildout.tests.normalize_S,
  45. zc.buildout.testing.not_found,
  46. (re.compile('[d-] zc.buildout(-\S+)?[.]egg(-link)?'),
  47. 'zc.buildout.egg'),
  48. (re.compile('[d-] distribute-[^-]+-'), 'distribute-X-'),
  49. (re.compile(r'eggs\\\\demo'), 'eggs/demo'),
  50. (re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
  51. ])
  52. ),
  53. doctest.DocFileSuite(
  54. 'api.txt',
  55. setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
  56. checker=renormalizing.RENormalizing([
  57. zc.buildout.testing.normalize_path,
  58. zc.buildout.testing.normalize_endings,
  59. zc.buildout.testing.not_found,
  60. (re.compile('__buildout_signature__ = '
  61. 'sample-\S+\s+'
  62. 'zc.recipe.egg-\S+\s+'
  63. 'distribute-\S+\s+'
  64. 'zc.buildout-\S+\s*'
  65. ),
  66. '__buildout_signature__ = sample- zc.recipe.egg-'),
  67. (re.compile('find-links = http://localhost:\d+/'),
  68. 'find-links = http://localhost:8080/'),
  69. (re.compile('index = http://localhost:\d+/index'),
  70. 'index = http://localhost:8080/index'),
  71. ])
  72. ),
  73. doctest.DocFileSuite(
  74. 'custom.txt',
  75. setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
  76. checker=renormalizing.RENormalizing([
  77. zc.buildout.testing.normalize_path,
  78. zc.buildout.testing.normalize_endings,
  79. zc.buildout.testing.not_found,
  80. (re.compile("(d ((ext)?demo(needed)?|other)"
  81. "-\d[.]\d-py)\d[.]\d(-\S+)?[.]egg"),
  82. '\\1V.V.egg'),
  83. (re.compile('extdemo.c\n.+\\extdemo.exp\n'), ''),
  84. (re.compile(
  85. r'zip_safe flag not set; analyzing archive contents.*\n'),
  86. ''),
  87. (re.compile(
  88. r'\n.*module references __file__'),
  89. ''),
  90. (re.compile(''), ''),
  91. (re.compile(
  92. "extdemo[.]c\n"
  93. "extdemo[.]obj : warning LNK4197: "
  94. "export 'initextdemo' specified multiple times; "
  95. "using first specification\n"
  96. " Creating library build\\\\temp[.]win-amd64-2[.]"
  97. "[4567]\\\\Release\\\\extdemo[.]lib and object "
  98. "build\\\\temp[.]win-amd64-2[.][4567]\\\\Re"
  99. "lease\\\\extdemo[.]exp\n"),
  100. ''),
  101. ]),
  102. ),
  103. ))
  104. return suite
  105. if __name__ == '__main__':
  106. unittest.main(defaultTest='test_suite')