bee_python 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. data/LICENSE +202 -0
  2. data/build/README +23 -0
  3. data/egg/egg/build.yml +70 -0
  4. data/egg/egg/ez_setup.py +280 -0
  5. data/egg/egg/script.py +12 -0
  6. data/egg/egg/setup.erb +11 -0
  7. data/egg/egg/suite.py +37 -0
  8. data/egg/egg/test.py +31 -0
  9. data/egg/egg.yml +69 -0
  10. data/egg/http/build.erb +53 -0
  11. data/egg/http/server.py +34 -0
  12. data/egg/http.yml +50 -0
  13. data/egg/mysql/mysql.py +43 -0
  14. data/egg/mysql.yml +44 -0
  15. data/egg/project/build.erb +77 -0
  16. data/egg/project/script.py +42 -0
  17. data/egg/project/test.py +31 -0
  18. data/egg/project.yml +59 -0
  19. data/egg/script/build.erb +35 -0
  20. data/egg/script/script.py +42 -0
  21. data/egg/script.yml +50 -0
  22. data/egg/soap/build.erb +52 -0
  23. data/egg/soap/client.py +18 -0
  24. data/egg/soap/server.py +30 -0
  25. data/egg/soap.yml +58 -0
  26. data/egg/source/source.py +42 -0
  27. data/egg/source.yml +47 -0
  28. data/egg/test/test.py +28 -0
  29. data/egg/test.yml +44 -0
  30. data/egg/xmlrpc/build.erb +52 -0
  31. data/egg/xmlrpc/client.py +22 -0
  32. data/egg/xmlrpc/server.py +24 -0
  33. data/egg/xmlrpc.yml +51 -0
  34. data/lib/bee_task_python.rb +390 -0
  35. data/test/build.yml +16 -0
  36. data/test/tc_bee_task_python.rb +27 -0
  37. data/test/test_build.rb +26 -0
  38. data/test/test_build_listener.rb +62 -0
  39. data/test/ts_bee_python.rb +26 -0
  40. data/tools/common/__init__.py +5 -0
  41. data/tools/common/common/__init__.py +140 -0
  42. data/tools/common/common/__pkginfo__.py +43 -0
  43. data/tools/common/common/adbh.py +35 -0
  44. data/tools/common/common/cache.py +114 -0
  45. data/tools/common/common/changelog.py +234 -0
  46. data/tools/common/common/clcommands.py +181 -0
  47. data/tools/common/common/cli.py +212 -0
  48. data/tools/common/common/compat.py +328 -0
  49. data/tools/common/common/configuration.py +1087 -0
  50. data/tools/common/common/contexts.py +58 -0
  51. data/tools/common/common/corbautils.py +117 -0
  52. data/tools/common/common/daemon.py +171 -0
  53. data/tools/common/common/date.py +279 -0
  54. data/tools/common/common/db.py +49 -0
  55. data/tools/common/common/dbf.py +229 -0
  56. data/tools/common/common/debugger.py +208 -0
  57. data/tools/common/common/decorators.py +190 -0
  58. data/tools/common/common/deprecation.py +118 -0
  59. data/tools/common/common/fileutils.py +409 -0
  60. data/tools/common/common/graph.py +259 -0
  61. data/tools/common/common/html.py +142 -0
  62. data/tools/common/common/interface.py +76 -0
  63. data/tools/common/common/logging_ext.py +166 -0
  64. data/tools/common/common/modutils.py +670 -0
  65. data/tools/common/common/optik_ext.py +383 -0
  66. data/tools/common/common/optparser.py +92 -0
  67. data/tools/common/common/pdf_ext.py +111 -0
  68. data/tools/common/common/proc.py +276 -0
  69. data/tools/common/common/pyro_ext.py +146 -0
  70. data/tools/common/common/pytest.py +754 -0
  71. data/tools/common/common/shellutils.py +383 -0
  72. data/tools/common/common/sphinx_ext.py +87 -0
  73. data/tools/common/common/sphinxutils.py +122 -0
  74. data/tools/common/common/sqlgen.py +31 -0
  75. data/tools/common/common/table.py +930 -0
  76. data/tools/common/common/tasksqueue.py +97 -0
  77. data/tools/common/common/test/__init__.py +1 -0
  78. data/tools/common/common/test/data/ChangeLog +184 -0
  79. data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  80. data/tools/common/common/test/data/__init__.py +1 -0
  81. data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
  82. data/tools/common/common/test/data/content_differ_dir/README +1 -0
  83. data/tools/common/common/test/data/content_differ_dir/subdir/coin +1 -0
  84. data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +53 -0
  85. data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
  86. data/tools/common/common/test/data/file_differ_dir/README +1 -0
  87. data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +53 -0
  88. data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  89. data/tools/common/common/test/data/find_test/__init__.py +0 -0
  90. data/tools/common/common/test/data/find_test/foo.txt +0 -0
  91. data/tools/common/common/test/data/find_test/module.py +0 -0
  92. data/tools/common/common/test/data/find_test/module2.py +0 -0
  93. data/tools/common/common/test/data/find_test/newlines.txt +0 -0
  94. data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
  95. data/tools/common/common/test/data/find_test/nonregr.py +0 -0
  96. data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
  97. data/tools/common/common/test/data/find_test/spam.txt +0 -0
  98. data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
  99. data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
  100. data/tools/common/common/test/data/find_test/test.ini +0 -0
  101. data/tools/common/common/test/data/find_test/test1.msg +0 -0
  102. data/tools/common/common/test/data/find_test/test2.msg +0 -0
  103. data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
  104. data/tools/common/common/test/data/foo.txt +9 -0
  105. data/tools/common/common/test/data/module.py +88 -0
  106. data/tools/common/common/test/data/module2.py +77 -0
  107. data/tools/common/common/test/data/newlines.txt +3 -0
  108. data/tools/common/common/test/data/noendingnewline.py +36 -0
  109. data/tools/common/common/test/data/nonregr.py +14 -0
  110. data/tools/common/common/test/data/normal_file.txt +0 -0
  111. data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
  112. data/tools/common/common/test/data/reference_dir/README +1 -0
  113. data/tools/common/common/test/data/reference_dir/subdir/coin +1 -0
  114. data/tools/common/common/test/data/reference_dir/subdir/toto.txt +53 -0
  115. data/tools/common/common/test/data/same_dir/NOTHING +0 -0
  116. data/tools/common/common/test/data/same_dir/README +1 -0
  117. data/tools/common/common/test/data/same_dir/subdir/coin +1 -0
  118. data/tools/common/common/test/data/same_dir/subdir/toto.txt +53 -0
  119. data/tools/common/common/test/data/spam.txt +9 -0
  120. data/tools/common/common/test/data/sub/doc.txt +1 -0
  121. data/tools/common/common/test/data/sub/momo.py +1 -0
  122. data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
  123. data/tools/common/common/test/data/subdir_differ_dir/README +1 -0
  124. data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +1 -0
  125. data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +53 -0
  126. data/tools/common/common/test/data/test.ini +20 -0
  127. data/tools/common/common/test/data/test1.msg +30 -0
  128. data/tools/common/common/test/data/test2.msg +42 -0
  129. data/tools/common/common/test/data/write_protected_file.txt +0 -0
  130. data/tools/common/common/test/foomod.py +17 -0
  131. data/tools/common/common/test/unittest_cache.py +129 -0
  132. data/tools/common/common/test/unittest_changelog.py +37 -0
  133. data/tools/common/common/test/unittest_compat.py +239 -0
  134. data/tools/common/common/test/unittest_configuration.py +348 -0
  135. data/tools/common/common/test/unittest_date.py +154 -0
  136. data/tools/common/common/test/unittest_decorators.py +62 -0
  137. data/tools/common/common/test/unittest_deprecation.py +76 -0
  138. data/tools/common/common/test/unittest_fileutils.py +133 -0
  139. data/tools/common/common/test/unittest_graph.py +50 -0
  140. data/tools/common/common/test/unittest_html.py +76 -0
  141. data/tools/common/common/test/unittest_interface.py +87 -0
  142. data/tools/common/common/test/unittest_modutils.py +244 -0
  143. data/tools/common/common/test/unittest_pytest.py +50 -0
  144. data/tools/common/common/test/unittest_shellutils.py +248 -0
  145. data/tools/common/common/test/unittest_table.py +448 -0
  146. data/tools/common/common/test/unittest_taskqueue.py +71 -0
  147. data/tools/common/common/test/unittest_testlib.py +956 -0
  148. data/tools/common/common/test/unittest_textutils.py +247 -0
  149. data/tools/common/common/test/unittest_tree.py +248 -0
  150. data/tools/common/common/test/unittest_umessage.py +55 -0
  151. data/tools/common/common/test/unittest_ureports_html.py +64 -0
  152. data/tools/common/common/test/unittest_ureports_text.py +105 -0
  153. data/tools/common/common/test/unittest_xmlutils.py +75 -0
  154. data/tools/common/common/test/utils.py +87 -0
  155. data/tools/common/common/testlib.py +1927 -0
  156. data/tools/common/common/textutils.py +476 -0
  157. data/tools/common/common/tree.py +372 -0
  158. data/tools/common/common/umessage.py +161 -0
  159. data/tools/common/common/ureports/__init__.py +174 -0
  160. data/tools/common/common/ureports/docbook_writer.py +139 -0
  161. data/tools/common/common/ureports/html_writer.py +131 -0
  162. data/tools/common/common/ureports/nodes.py +201 -0
  163. data/tools/common/common/ureports/text_writer.py +140 -0
  164. data/tools/common/common/vcgutils.py +216 -0
  165. data/tools/common/common/visitor.py +107 -0
  166. data/tools/common/common/xmlrpcutils.py +136 -0
  167. data/tools/common/common/xmlutils.py +61 -0
  168. data/tools/compile/compile.py +16 -0
  169. data/tools/coverage/coverage.py +602 -0
  170. data/tools/epydoc/__init__.py +227 -0
  171. data/tools/epydoc/__init__.pyc +0 -0
  172. data/tools/epydoc/apidoc.py +2203 -0
  173. data/tools/epydoc/apidoc.pyc +0 -0
  174. data/tools/epydoc/checker.py +349 -0
  175. data/tools/epydoc/checker.pyc +0 -0
  176. data/tools/epydoc/cli.py +1470 -0
  177. data/tools/epydoc/cli.pyc +0 -0
  178. data/tools/epydoc/compat.py +250 -0
  179. data/tools/epydoc/compat.pyc +0 -0
  180. data/tools/epydoc/docbuilder.py +1358 -0
  181. data/tools/epydoc/docbuilder.pyc +0 -0
  182. data/tools/epydoc/docintrospecter.py +1056 -0
  183. data/tools/epydoc/docintrospecter.pyc +0 -0
  184. data/tools/epydoc/docparser.py +2113 -0
  185. data/tools/epydoc/docparser.pyc +0 -0
  186. data/tools/epydoc/docstringparser.py +1111 -0
  187. data/tools/epydoc/docstringparser.pyc +0 -0
  188. data/tools/epydoc/docwriter/__init__.py +12 -0
  189. data/tools/epydoc/docwriter/__init__.pyc +0 -0
  190. data/tools/epydoc/docwriter/dotgraph.py +1351 -0
  191. data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
  192. data/tools/epydoc/docwriter/html.py +3491 -0
  193. data/tools/epydoc/docwriter/html.pyc +0 -0
  194. data/tools/epydoc/docwriter/html_colorize.py +909 -0
  195. data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
  196. data/tools/epydoc/docwriter/html_css.py +550 -0
  197. data/tools/epydoc/docwriter/html_css.pyc +0 -0
  198. data/tools/epydoc/docwriter/html_help.py +190 -0
  199. data/tools/epydoc/docwriter/html_help.pyc +0 -0
  200. data/tools/epydoc/docwriter/latex.py +1187 -0
  201. data/tools/epydoc/docwriter/latex.pyc +0 -0
  202. data/tools/epydoc/docwriter/plaintext.py +276 -0
  203. data/tools/epydoc/docwriter/plaintext.pyc +0 -0
  204. data/tools/epydoc/docwriter/xlink.py +505 -0
  205. data/tools/epydoc/docwriter/xlink.pyc +0 -0
  206. data/tools/epydoc/gui.py +1148 -0
  207. data/tools/epydoc/gui.pyc +0 -0
  208. data/tools/epydoc/log.py +204 -0
  209. data/tools/epydoc/log.pyc +0 -0
  210. data/tools/epydoc/markup/__init__.py +623 -0
  211. data/tools/epydoc/markup/__init__.pyc +0 -0
  212. data/tools/epydoc/markup/doctest.py +311 -0
  213. data/tools/epydoc/markup/doctest.pyc +0 -0
  214. data/tools/epydoc/markup/epytext.py +2116 -0
  215. data/tools/epydoc/markup/epytext.pyc +0 -0
  216. data/tools/epydoc/markup/javadoc.py +250 -0
  217. data/tools/epydoc/markup/javadoc.pyc +0 -0
  218. data/tools/epydoc/markup/plaintext.py +78 -0
  219. data/tools/epydoc/markup/plaintext.pyc +0 -0
  220. data/tools/epydoc/markup/pyval_repr.py +532 -0
  221. data/tools/epydoc/markup/pyval_repr.pyc +0 -0
  222. data/tools/epydoc/markup/restructuredtext.py +906 -0
  223. data/tools/epydoc/markup/restructuredtext.pyc +0 -0
  224. data/tools/epydoc/test/__init__.py +97 -0
  225. data/tools/epydoc/test/__init__.pyc +0 -0
  226. data/tools/epydoc/test/util.py +226 -0
  227. data/tools/epydoc/test/util.pyc +0 -0
  228. data/tools/epydoc/util.py +289 -0
  229. data/tools/epydoc/util.pyc +0 -0
  230. data/tools/logilab/logilab/__init__.py +5 -0
  231. data/tools/logilab/logilab/astng/__init__.py +82 -0
  232. data/tools/logilab/logilab/astng/__pkginfo__.py +76 -0
  233. data/tools/logilab/logilab/astng/_exceptions.py +64 -0
  234. data/tools/logilab/logilab/astng/_nodes_ast.py +667 -0
  235. data/tools/logilab/logilab/astng/_nodes_compiler.py +758 -0
  236. data/tools/logilab/logilab/astng/bases.py +608 -0
  237. data/tools/logilab/logilab/astng/builder.py +239 -0
  238. data/tools/logilab/logilab/astng/inference.py +426 -0
  239. data/tools/logilab/logilab/astng/inspector.py +289 -0
  240. data/tools/logilab/logilab/astng/manager.py +421 -0
  241. data/tools/logilab/logilab/astng/mixins.py +165 -0
  242. data/tools/logilab/logilab/astng/node_classes.py +848 -0
  243. data/tools/logilab/logilab/astng/nodes.py +85 -0
  244. data/tools/logilab/logilab/astng/nodes_as_string.py +389 -0
  245. data/tools/logilab/logilab/astng/patchcomptransformer.py +159 -0
  246. data/tools/logilab/logilab/astng/protocols.py +333 -0
  247. data/tools/logilab/logilab/astng/raw_building.py +212 -0
  248. data/tools/logilab/logilab/astng/rebuilder.py +307 -0
  249. data/tools/logilab/logilab/astng/scoped_nodes.py +951 -0
  250. data/tools/logilab/logilab/astng/test/__init__.py +19 -0
  251. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  252. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
  253. data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +33 -0
  254. data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +20 -0
  255. data/tools/logilab/logilab/astng/test/data/__init__.py +20 -0
  256. data/tools/logilab/logilab/astng/test/data/all.py +29 -0
  257. data/tools/logilab/logilab/astng/test/data/appl/__init__.py +23 -0
  258. data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +30 -0
  259. data/tools/logilab/logilab/astng/test/data/format.py +34 -0
  260. data/tools/logilab/logilab/astng/test/data/module.py +90 -0
  261. data/tools/logilab/logilab/astng/test/data/module2.py +112 -0
  262. data/tools/logilab/logilab/astng/test/data/noendingnewline.py +57 -0
  263. data/tools/logilab/logilab/astng/test/data/nonregr.py +76 -0
  264. data/tools/logilab/logilab/astng/test/data/notall.py +28 -0
  265. data/tools/logilab/logilab/astng/test/data2/__init__.py +20 -0
  266. data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +51 -0
  267. data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +32 -0
  268. data/tools/logilab/logilab/astng/test/regrtest.py +135 -0
  269. data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +22 -0
  270. data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +31 -0
  271. data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +68 -0
  272. data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +24 -0
  273. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +20 -0
  274. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +20 -0
  275. data/tools/logilab/logilab/astng/test/unittest_builder.py +684 -0
  276. data/tools/logilab/logilab/astng/test/unittest_inference.py +1112 -0
  277. data/tools/logilab/logilab/astng/test/unittest_inspector.py +105 -0
  278. data/tools/logilab/logilab/astng/test/unittest_lookup.py +302 -0
  279. data/tools/logilab/logilab/astng/test/unittest_manager.py +98 -0
  280. data/tools/logilab/logilab/astng/test/unittest_nodes.py +302 -0
  281. data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +501 -0
  282. data/tools/logilab/logilab/astng/test/unittest_utils.py +104 -0
  283. data/tools/logilab/logilab/astng/utils.py +342 -0
  284. data/tools/logilab/logilab/common/__init__.py +140 -0
  285. data/tools/logilab/logilab/common/__pkginfo__.py +43 -0
  286. data/tools/logilab/logilab/common/adbh.py +35 -0
  287. data/tools/logilab/logilab/common/cache.py +114 -0
  288. data/tools/logilab/logilab/common/changelog.py +234 -0
  289. data/tools/logilab/logilab/common/clcommands.py +181 -0
  290. data/tools/logilab/logilab/common/cli.py +212 -0
  291. data/tools/logilab/logilab/common/compat.py +328 -0
  292. data/tools/logilab/logilab/common/configuration.py +1087 -0
  293. data/tools/logilab/logilab/common/contexts.py +58 -0
  294. data/tools/logilab/logilab/common/corbautils.py +117 -0
  295. data/tools/logilab/logilab/common/daemon.py +171 -0
  296. data/tools/logilab/logilab/common/date.py +279 -0
  297. data/tools/logilab/logilab/common/db.py +49 -0
  298. data/tools/logilab/logilab/common/dbf.py +229 -0
  299. data/tools/logilab/logilab/common/debugger.py +208 -0
  300. data/tools/logilab/logilab/common/decorators.py +190 -0
  301. data/tools/logilab/logilab/common/deprecation.py +118 -0
  302. data/tools/logilab/logilab/common/fileutils.py +409 -0
  303. data/tools/logilab/logilab/common/graph.py +259 -0
  304. data/tools/logilab/logilab/common/html.py +142 -0
  305. data/tools/logilab/logilab/common/interface.py +76 -0
  306. data/tools/logilab/logilab/common/logging_ext.py +166 -0
  307. data/tools/logilab/logilab/common/modutils.py +670 -0
  308. data/tools/logilab/logilab/common/optik_ext.py +383 -0
  309. data/tools/logilab/logilab/common/optparser.py +92 -0
  310. data/tools/logilab/logilab/common/pdf_ext.py +111 -0
  311. data/tools/logilab/logilab/common/proc.py +276 -0
  312. data/tools/logilab/logilab/common/pyro_ext.py +146 -0
  313. data/tools/logilab/logilab/common/pytest.py +754 -0
  314. data/tools/logilab/logilab/common/shellutils.py +383 -0
  315. data/tools/logilab/logilab/common/sphinx_ext.py +87 -0
  316. data/tools/logilab/logilab/common/sphinxutils.py +122 -0
  317. data/tools/logilab/logilab/common/sqlgen.py +31 -0
  318. data/tools/logilab/logilab/common/table.py +930 -0
  319. data/tools/logilab/logilab/common/tasksqueue.py +97 -0
  320. data/tools/logilab/logilab/common/test/__init__.py +1 -0
  321. data/tools/logilab/logilab/common/test/data/ChangeLog +184 -0
  322. data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  323. data/tools/logilab/logilab/common/test/data/__init__.py +1 -0
  324. data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
  325. data/tools/logilab/logilab/common/test/data/content_differ_dir/README +1 -0
  326. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +1 -0
  327. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +53 -0
  328. data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
  329. data/tools/logilab/logilab/common/test/data/file_differ_dir/README +1 -0
  330. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +53 -0
  331. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  332. data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
  333. data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
  334. data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
  335. data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
  336. data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
  337. data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
  338. data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
  339. data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
  340. data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
  341. data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
  342. data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
  343. data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
  344. data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
  345. data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
  346. data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
  347. data/tools/logilab/logilab/common/test/data/foo.txt +9 -0
  348. data/tools/logilab/logilab/common/test/data/module.py +88 -0
  349. data/tools/logilab/logilab/common/test/data/module2.py +77 -0
  350. data/tools/logilab/logilab/common/test/data/newlines.txt +3 -0
  351. data/tools/logilab/logilab/common/test/data/noendingnewline.py +36 -0
  352. data/tools/logilab/logilab/common/test/data/nonregr.py +14 -0
  353. data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
  354. data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
  355. data/tools/logilab/logilab/common/test/data/reference_dir/README +1 -0
  356. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +1 -0
  357. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +53 -0
  358. data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
  359. data/tools/logilab/logilab/common/test/data/same_dir/README +1 -0
  360. data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +1 -0
  361. data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +53 -0
  362. data/tools/logilab/logilab/common/test/data/spam.txt +9 -0
  363. data/tools/logilab/logilab/common/test/data/sub/doc.txt +1 -0
  364. data/tools/logilab/logilab/common/test/data/sub/momo.py +1 -0
  365. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
  366. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +1 -0
  367. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +1 -0
  368. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +53 -0
  369. data/tools/logilab/logilab/common/test/data/test.ini +20 -0
  370. data/tools/logilab/logilab/common/test/data/test1.msg +30 -0
  371. data/tools/logilab/logilab/common/test/data/test2.msg +42 -0
  372. data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
  373. data/tools/logilab/logilab/common/test/foomod.py +17 -0
  374. data/tools/logilab/logilab/common/test/unittest_cache.py +129 -0
  375. data/tools/logilab/logilab/common/test/unittest_changelog.py +37 -0
  376. data/tools/logilab/logilab/common/test/unittest_compat.py +239 -0
  377. data/tools/logilab/logilab/common/test/unittest_configuration.py +348 -0
  378. data/tools/logilab/logilab/common/test/unittest_date.py +154 -0
  379. data/tools/logilab/logilab/common/test/unittest_decorators.py +62 -0
  380. data/tools/logilab/logilab/common/test/unittest_deprecation.py +76 -0
  381. data/tools/logilab/logilab/common/test/unittest_fileutils.py +133 -0
  382. data/tools/logilab/logilab/common/test/unittest_graph.py +50 -0
  383. data/tools/logilab/logilab/common/test/unittest_html.py +76 -0
  384. data/tools/logilab/logilab/common/test/unittest_interface.py +87 -0
  385. data/tools/logilab/logilab/common/test/unittest_modutils.py +244 -0
  386. data/tools/logilab/logilab/common/test/unittest_pytest.py +50 -0
  387. data/tools/logilab/logilab/common/test/unittest_shellutils.py +248 -0
  388. data/tools/logilab/logilab/common/test/unittest_table.py +448 -0
  389. data/tools/logilab/logilab/common/test/unittest_taskqueue.py +71 -0
  390. data/tools/logilab/logilab/common/test/unittest_testlib.py +956 -0
  391. data/tools/logilab/logilab/common/test/unittest_textutils.py +247 -0
  392. data/tools/logilab/logilab/common/test/unittest_tree.py +248 -0
  393. data/tools/logilab/logilab/common/test/unittest_umessage.py +55 -0
  394. data/tools/logilab/logilab/common/test/unittest_ureports_html.py +64 -0
  395. data/tools/logilab/logilab/common/test/unittest_ureports_text.py +105 -0
  396. data/tools/logilab/logilab/common/test/unittest_xmlutils.py +75 -0
  397. data/tools/logilab/logilab/common/test/utils.py +87 -0
  398. data/tools/logilab/logilab/common/testlib.py +1927 -0
  399. data/tools/logilab/logilab/common/textutils.py +476 -0
  400. data/tools/logilab/logilab/common/tree.py +372 -0
  401. data/tools/logilab/logilab/common/umessage.py +161 -0
  402. data/tools/logilab/logilab/common/ureports/__init__.py +174 -0
  403. data/tools/logilab/logilab/common/ureports/docbook_writer.py +139 -0
  404. data/tools/logilab/logilab/common/ureports/html_writer.py +131 -0
  405. data/tools/logilab/logilab/common/ureports/nodes.py +201 -0
  406. data/tools/logilab/logilab/common/ureports/text_writer.py +140 -0
  407. data/tools/logilab/logilab/common/vcgutils.py +216 -0
  408. data/tools/logilab/logilab/common/visitor.py +107 -0
  409. data/tools/logilab/logilab/common/xmlrpcutils.py +136 -0
  410. data/tools/logilab/logilab/common/xmlutils.py +61 -0
  411. data/tools/pychecker/COPYRIGHT +31 -0
  412. data/tools/pychecker/ChangeLog +349 -0
  413. data/tools/pychecker/CodeChecks.py +1969 -0
  414. data/tools/pychecker/CodeChecks.pyc +0 -0
  415. data/tools/pychecker/CodeChecks.pyo +0 -0
  416. data/tools/pychecker/Config.py +475 -0
  417. data/tools/pychecker/Config.pyc +0 -0
  418. data/tools/pychecker/Config.pyo +0 -0
  419. data/tools/pychecker/KNOWN_BUGS +100 -0
  420. data/tools/pychecker/MAINTAINERS +81 -0
  421. data/tools/pychecker/NEWS +406 -0
  422. data/tools/pychecker/OP.py +131 -0
  423. data/tools/pychecker/OP.pyc +0 -0
  424. data/tools/pychecker/OP.pyo +0 -0
  425. data/tools/pychecker/OptionTypes.py +117 -0
  426. data/tools/pychecker/OptionTypes.pyc +0 -0
  427. data/tools/pychecker/OptionTypes.pyo +0 -0
  428. data/tools/pychecker/README +152 -0
  429. data/tools/pychecker/Stack.py +115 -0
  430. data/tools/pychecker/Stack.pyc +0 -0
  431. data/tools/pychecker/Stack.pyo +0 -0
  432. data/tools/pychecker/TODO +101 -0
  433. data/tools/pychecker/VERSION +1 -0
  434. data/tools/pychecker/Warning.py +50 -0
  435. data/tools/pychecker/Warning.pyc +0 -0
  436. data/tools/pychecker/Warning.pyo +0 -0
  437. data/tools/pychecker/__init__.py +17 -0
  438. data/tools/pychecker/__init__.pyc +0 -0
  439. data/tools/pychecker/__init__.pyo +0 -0
  440. data/tools/pychecker/checker.py +961 -0
  441. data/tools/pychecker/checker.pyc +0 -0
  442. data/tools/pychecker/checker.pyo +0 -0
  443. data/tools/pychecker/function.py +159 -0
  444. data/tools/pychecker/function.pyc +0 -0
  445. data/tools/pychecker/function.pyo +0 -0
  446. data/tools/pychecker/msgs.py +175 -0
  447. data/tools/pychecker/msgs.pyc +0 -0
  448. data/tools/pychecker/msgs.pyo +0 -0
  449. data/tools/pychecker/options.py +275 -0
  450. data/tools/pychecker/options.pyc +0 -0
  451. data/tools/pychecker/options.pyo +0 -0
  452. data/tools/pychecker/pcmodules.py +19 -0
  453. data/tools/pychecker/pcmodules.pyc +0 -0
  454. data/tools/pychecker/pcmodules.pyo +0 -0
  455. data/tools/pychecker/printer.py +47 -0
  456. data/tools/pychecker/printer.pyc +0 -0
  457. data/tools/pychecker/printer.pyo +0 -0
  458. data/tools/pychecker/python.py +427 -0
  459. data/tools/pychecker/python.pyc +0 -0
  460. data/tools/pychecker/python.pyo +0 -0
  461. data/tools/pychecker/utils.py +102 -0
  462. data/tools/pychecker/utils.pyc +0 -0
  463. data/tools/pychecker/utils.pyo +0 -0
  464. data/tools/pychecker/warn.py +778 -0
  465. data/tools/pychecker/warn.pyc +0 -0
  466. data/tools/pychecker/warn.pyo +0 -0
  467. data/tools/pylint2/pylint/__init__.py +16 -0
  468. data/tools/pylint2/pylint/__pkginfo__.py +67 -0
  469. data/tools/pylint2/pylint/checkers/__init__.py +155 -0
  470. data/tools/pylint2/pylint/checkers/base.py +749 -0
  471. data/tools/pylint2/pylint/checkers/classes.py +527 -0
  472. data/tools/pylint2/pylint/checkers/design_analysis.py +344 -0
  473. data/tools/pylint2/pylint/checkers/exceptions.py +183 -0
  474. data/tools/pylint2/pylint/checkers/format.py +367 -0
  475. data/tools/pylint2/pylint/checkers/imports.py +379 -0
  476. data/tools/pylint2/pylint/checkers/logging.py +98 -0
  477. data/tools/pylint2/pylint/checkers/misc.py +128 -0
  478. data/tools/pylint2/pylint/checkers/newstyle.py +107 -0
  479. data/tools/pylint2/pylint/checkers/raw_metrics.py +125 -0
  480. data/tools/pylint2/pylint/checkers/similar.py +333 -0
  481. data/tools/pylint2/pylint/checkers/string_format.py +239 -0
  482. data/tools/pylint2/pylint/checkers/typecheck.py +364 -0
  483. data/tools/pylint2/pylint/checkers/utils.py +208 -0
  484. data/tools/pylint2/pylint/checkers/variables.py +498 -0
  485. data/tools/pylint2/pylint/config.py +149 -0
  486. data/tools/pylint2/pylint/epylint.py +149 -0
  487. data/tools/pylint2/pylint/gui.py +433 -0
  488. data/tools/pylint2/pylint/interfaces.py +98 -0
  489. data/tools/pylint2/pylint/lint.py +914 -0
  490. data/tools/pylint2/pylint/pyreverse/__init__.py +5 -0
  491. data/tools/pylint2/pylint/pyreverse/diadefslib.py +229 -0
  492. data/tools/pylint2/pylint/pyreverse/diagrams.py +247 -0
  493. data/tools/pylint2/pylint/pyreverse/main.py +123 -0
  494. data/tools/pylint2/pylint/pyreverse/utils.py +131 -0
  495. data/tools/pylint2/pylint/pyreverse/writer.py +196 -0
  496. data/tools/pylint2/pylint/reporters/__init__.py +67 -0
  497. data/tools/pylint2/pylint/reporters/guireporter.py +36 -0
  498. data/tools/pylint2/pylint/reporters/html.py +69 -0
  499. data/tools/pylint2/pylint/reporters/text.py +156 -0
  500. data/tools/pylint2/pylint/utils.py +518 -0
  501. data/tools/pylint2/pylint.py +16 -0
  502. data/tools/test/suite.py +35 -0
  503. metadata +566 -0
@@ -0,0 +1,956 @@
1
+ # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2
+ # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3
+ #
4
+ # This file is part of logilab-common.
5
+ #
6
+ # logilab-common is free software: you can redistribute it and/or modify it under
7
+ # the terms of the GNU Lesser General Public License as published by the Free
8
+ # Software Foundation, either version 2.1 of the License, or (at your option) any
9
+ # later version.
10
+ #
11
+ # logilab-common is distributed in the hope that it will be useful, but WITHOUT
12
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14
+ # details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License along
17
+ # with logilab-common. If not, see <http://www.gnu.org/licenses/>.
18
+ """unittest module for logilab.comon.testlib"""
19
+
20
+ import unittest
21
+ import os
22
+ import sys
23
+ from os.path import join, dirname, isdir, isfile, abspath, exists
24
+ from cStringIO import StringIO
25
+ import tempfile
26
+ import shutil
27
+
28
+ from logilab.common.compat import sorted
29
+
30
+ try:
31
+ __file__
32
+ except NameError:
33
+ __file__ = sys.argv[0]
34
+
35
+
36
+ from unittest import TestSuite
37
+
38
+ from logilab.common.testlib import TestCase, SkipAwareTextTestRunner, Tags
39
+ from logilab.common.testlib import mock_object, NonStrictTestLoader, create_files
40
+ from logilab.common.testlib import capture_stdout, unittest_main, InnerTest
41
+ from logilab.common.testlib import with_tempdir, tag
42
+ from logilab.common.testlib import require_version, require_module
43
+
44
+ class MockTestCase(TestCase):
45
+ def __init__(self):
46
+ # Do not call unittest.TestCase's __init__
47
+ pass
48
+
49
+ def fail(self, msg):
50
+ raise AssertionError(msg)
51
+
52
+ class UtilTC(TestCase):
53
+
54
+ def test_mockobject(self):
55
+ obj = mock_object(foo='bar', baz='bam')
56
+ self.assertEquals(obj.foo, 'bar')
57
+ self.assertEquals(obj.baz, 'bam')
58
+
59
+
60
+ def test_create_files(self):
61
+ chroot = tempfile.mkdtemp()
62
+ path_to = lambda path: join(chroot, path)
63
+ dircontent = lambda path: sorted(os.listdir(join(chroot, path)))
64
+ try:
65
+ self.failIf(isdir(path_to('a/')))
66
+ create_files(['a/b/foo.py', 'a/b/c/', 'a/b/c/d/e.py'], chroot)
67
+ # make sure directories exist
68
+ self.failUnless(isdir(path_to('a')))
69
+ self.failUnless(isdir(path_to('a/b')))
70
+ self.failUnless(isdir(path_to('a/b/c')))
71
+ self.failUnless(isdir(path_to('a/b/c/d')))
72
+ # make sure files exist
73
+ self.failUnless(isfile(path_to('a/b/foo.py')))
74
+ self.failUnless(isfile(path_to('a/b/c/d/e.py')))
75
+ # make sure only asked files were created
76
+ self.assertEquals(dircontent('a'), ['b'])
77
+ self.assertEquals(dircontent('a/b'), ['c', 'foo.py'])
78
+ self.assertEquals(dircontent('a/b/c'), ['d'])
79
+ self.assertEquals(dircontent('a/b/c/d'), ['e.py'])
80
+ finally:
81
+ shutil.rmtree(chroot)
82
+
83
+
84
+ class TestlibTC(TestCase):
85
+
86
+ capture = True
87
+
88
+ def mkdir(self,path):
89
+ if not exists(path):
90
+ self._dirs.add(path)
91
+ os.mkdir(path)
92
+
93
+ def setUp(self):
94
+ self.tc = MockTestCase()
95
+ self._dirs = set()
96
+
97
+ def tearDown(self):
98
+ while(self._dirs):
99
+ shutil.rmtree(self._dirs.pop(), ignore_errors=True)
100
+
101
+ def test_dict_equals(self):
102
+ """tests TestCase.assertDictEquals"""
103
+ d1 = {'a' : 1, 'b' : 2}
104
+ d2 = {'a' : 1, 'b' : 3}
105
+ d3 = dict(d1)
106
+ self.assertRaises(AssertionError, self.tc.assertDictEquals, d1, d2)
107
+ self.tc.assertDictEquals(d1, d3)
108
+ self.tc.assertDictEquals(d3, d1)
109
+ self.tc.assertDictEquals(d1, d1)
110
+
111
+ def test_list_equals(self):
112
+ """tests TestCase.assertListEquals"""
113
+ l1 = range(10)
114
+ l2 = range(5)
115
+ l3 = range(10)
116
+ self.assertRaises(AssertionError, self.tc.assertListEquals, l1, l2)
117
+ self.tc.assertListEquals(l1, l1)
118
+ self.tc.assertListEquals(l1, l3)
119
+ self.tc.assertListEquals(l3, l1)
120
+
121
+ def test_lines_equals(self):
122
+ """tests assertLineEquals"""
123
+ t1 = """some
124
+ text
125
+ """
126
+ t2 = """some
127
+
128
+ text"""
129
+ t3 = """some
130
+ text"""
131
+ self.assertRaises(AssertionError, self.tc.assertLinesEquals, t1, t2)
132
+ self.tc.assertLinesEquals(t1, t3)
133
+ self.tc.assertLinesEquals(t3, t1)
134
+ self.tc.assertLinesEquals(t1, t1)
135
+
136
+ def test_xml_valid(self):
137
+ """tests xml is valid"""
138
+ valid = """<root>
139
+ <hello />
140
+ <world>Logilab</world>
141
+ </root>"""
142
+ invalid = """<root><h2> </root>"""
143
+ self.tc.assertXMLStringWellFormed(valid)
144
+ self.assertRaises(AssertionError, self.tc.assertXMLStringWellFormed, invalid)
145
+ invalid = """<root><h2 </h2> </root>"""
146
+ self.assertRaises(AssertionError, self.tc.assertXMLStringWellFormed, invalid)
147
+
148
+
149
+ def test_unordered_equality_for_lists(self):
150
+ l1 = [0, 1, 2]
151
+ l2 = [1, 2, 3]
152
+ self.assertRaises(AssertionError, self.tc.assertUnorderedIterableEquals, l1, l2)
153
+ self.tc.assertUnorderedIterableEquals(l1, l1)
154
+ self.tc.assertUnorderedIterableEquals([], [])
155
+ l1 = [0, 1, 1]
156
+ l2 = [0, 1]
157
+ self.assertRaises(AssertionError, self.tc.assertUnorderedIterableEquals, l1, l2)
158
+ self.tc.assertUnorderedIterableEquals(l1, l1)
159
+
160
+
161
+ def test_unordered_equality_for_dicts(self):
162
+ d1 = {'a' : 1, 'b' : 2}
163
+ d2 = {'a' : 1}
164
+ self.assertRaises(AssertionError, self.tc.assertUnorderedIterableEquals, d1, d2)
165
+ self.tc.assertUnorderedIterableEquals(d1, d1)
166
+ self.tc.assertUnorderedIterableEquals({}, {})
167
+
168
+ def test_unordered_equality_for_iterables(self):
169
+ self.assertRaises(AssertionError, self.tc.assertUnorderedIterableEquals, xrange(5), xrange(6))
170
+ self.tc.assertUnorderedIterableEquals(xrange(5), range(5))
171
+ self.tc.assertUnorderedIterableEquals([], ())
172
+
173
+ def test_unordered_equality_for_dicts(self):
174
+ s1 = set('ab')
175
+ s2 = set('a')
176
+ self.assertRaises(AssertionError, self.tc.assertSetEquals, s1, s2)
177
+ self.tc.assertSetEquals(s1, s1)
178
+ self.tc.assertSetEquals(set(), set())
179
+
180
+ def test_file_equality(self):
181
+ foo = join(dirname(__file__), 'data', 'foo.txt')
182
+ spam = join(dirname(__file__), 'data', 'spam.txt')
183
+ self.assertRaises(AssertionError, self.tc.assertFileEqual, foo, spam)
184
+ self.tc.assertFileEqual(foo, foo)
185
+
186
+ def test_dir_equality(self):
187
+ ref = join(dirname(__file__), 'data', 'reference_dir')
188
+ same = join(dirname(__file__), 'data', 'same_dir')
189
+ subdir_differ = join(dirname(__file__), 'data', 'subdir_differ_dir')
190
+ file_differ = join(dirname(__file__), 'data', 'file_differ_dir')
191
+ content_differ = join(dirname(__file__), 'data', 'content_differ_dir')
192
+ ed1 = join(dirname(__file__), 'data', 'empty_dir_1')
193
+ ed2 = join(dirname(__file__), 'data', 'empty_dir_2')
194
+
195
+ for path in (ed1, ed2, join(subdir_differ,'unexpected')):
196
+ self.mkdir(path)
197
+
198
+ self.assertDirEquals(ed1, ed2)
199
+ self.assertDirEquals(ref, ref)
200
+ self.assertDirEquals( ref, same)
201
+ self.assertRaises(AssertionError, self.assertDirEquals, ed1, ref)
202
+ self.assertRaises(AssertionError, self.assertDirEquals, ref, ed2)
203
+ self.assertRaises(AssertionError, self.assertDirEquals, subdir_differ, ref)
204
+ self.assertRaises(AssertionError, self.assertDirEquals, file_differ, ref)
205
+ self.assertRaises(AssertionError, self.assertDirEquals, ref, content_differ)
206
+
207
+ def test_stream_equality(self):
208
+ foo = join(dirname(__file__), 'data', 'foo.txt')
209
+ spam = join(dirname(__file__), 'data', 'spam.txt')
210
+ stream1 = file(foo)
211
+ self.tc.assertStreamEqual(stream1, stream1)
212
+ stream1 = file(foo)
213
+ stream2 = file(spam)
214
+ self.assertRaises(AssertionError, self.tc.assertStreamEqual, stream1, stream2)
215
+
216
+ def test_text_equality(self):
217
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, "toto", 12)
218
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, "toto", None)
219
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, 3.12, u"toto")
220
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, None, u"toto")
221
+ self.tc.assertTextEqual('toto\ntiti', 'toto\ntiti')
222
+ self.tc.assertTextEqual('toto\ntiti', 'toto\n titi\n', striplines=True)
223
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, 'toto\ntiti', 'toto\n titi\n')
224
+ foo = join(dirname(__file__), 'data', 'foo.txt')
225
+ spam = join(dirname(__file__), 'data', 'spam.txt')
226
+ text1 = file(foo).read()
227
+ self.tc.assertTextEqual(text1, text1)
228
+ text2 = file(spam).read()
229
+ self.assertRaises(AssertionError, self.tc.assertTextEqual, text1, text2)
230
+
231
+
232
+ def test_assert_raises(self):
233
+ exc = self.tc.assertRaises(KeyError, {}.__getitem__, 'foo')
234
+ self.failUnless(isinstance(exc, KeyError))
235
+ self.assertEquals(exc.args, ('foo',))
236
+
237
+
238
+ def test_default_datadir(self):
239
+ expected_datadir = join(dirname(abspath(__file__)), 'data')
240
+ self.assertEquals(self.datadir, expected_datadir)
241
+ self.assertEquals(self.datapath('foo'), join(expected_datadir, 'foo'))
242
+
243
+ def test_multiple_args_datadir(self):
244
+ expected_datadir = join(dirname(abspath(__file__)), 'data')
245
+ self.assertEquals(self.datadir, expected_datadir)
246
+ self.assertEquals(self.datapath('foo', 'bar'), join(expected_datadir, 'foo', 'bar'))
247
+
248
+ def test_custom_datadir(self):
249
+ class MyTC(TestCase):
250
+ datadir = 'foo'
251
+ def test_1(self): pass
252
+
253
+ # class' custom datadir
254
+ tc = MyTC('test_1')
255
+ self.assertEquals(tc.datapath('bar'), join('foo', 'bar'))
256
+ # instance's custom datadir
257
+ self.skip('should this really works?')
258
+ tc.datadir = 'spam'
259
+ self.assertEquals(tc.datapath('bar'), join('spam', 'bar'))
260
+
261
+
262
+ def test_cached_datadir(self):
263
+ """test datadir is cached on the class"""
264
+ class MyTC(TestCase):
265
+ def test_1(self): pass
266
+
267
+ expected_datadir = join(dirname(abspath(__file__)), 'data')
268
+ tc = MyTC('test_1')
269
+ self.assertEquals(tc.datadir, expected_datadir)
270
+ # changing module should not change the datadir
271
+ MyTC.__module__ = 'os'
272
+ self.assertEquals(tc.datadir, expected_datadir)
273
+ # even on new instances
274
+ tc2 = MyTC('test_1')
275
+ self.assertEquals(tc2.datadir, expected_datadir)
276
+
277
+ def test_is(self):
278
+ obj_1 = []
279
+ obj_2 = []
280
+ self.assertIs(obj_1,obj_1)
281
+ self.assertRaises(AssertionError, self.assertIs, obj_1, obj_2)
282
+
283
+ def test_isnot(self):
284
+ obj_1 = []
285
+ obj_2 = []
286
+ self.assertIsNot(obj_1,obj_2)
287
+ self.assertRaises(AssertionError, self.assertIsNot, obj_1, obj_1)
288
+
289
+ def test_none(self):
290
+ self.assertNone(None)
291
+ self.assertRaises(AssertionError, self.assertNone, object())
292
+
293
+ def test_none(self):
294
+ self.assertNotNone(object())
295
+ self.assertRaises(AssertionError, self.assertNotNone, None)
296
+
297
+ def test_in(self):
298
+ self.assertIn("a", "dsqgaqg")
299
+ obj, seq = 'a', ('toto', "azf", "coin")
300
+ self.assertRaises(AssertionError, self.assertIn, obj, seq)
301
+
302
+ def test_not_in(self):
303
+ self.assertNotIn('a', ('toto', "azf", "coin"))
304
+ self.assertRaises(AssertionError, self.assertNotIn, 'a', "dsqgaqg")
305
+
306
+
307
+ class GenerativeTestsTC(TestCase):
308
+
309
+ def setUp(self):
310
+ output = StringIO()
311
+ self.runner = SkipAwareTextTestRunner(stream=output)
312
+
313
+ def test_generative_ok(self):
314
+ class FooTC(TestCase):
315
+ def test_generative(self):
316
+ for i in xrange(10):
317
+ yield self.assertEquals, i, i
318
+ result = self.runner.run(FooTC('test_generative'))
319
+ self.assertEquals(result.testsRun, 10)
320
+ self.assertEquals(len(result.failures), 0)
321
+ self.assertEquals(len(result.errors), 0)
322
+
323
+
324
+ def test_generative_half_bad(self):
325
+ class FooTC(TestCase):
326
+ def test_generative(self):
327
+ for i in xrange(10):
328
+ yield self.assertEquals, i%2, 0
329
+ result = self.runner.run(FooTC('test_generative'))
330
+ self.assertEquals(result.testsRun, 10)
331
+ self.assertEquals(len(result.failures), 5)
332
+ self.assertEquals(len(result.errors), 0)
333
+
334
+
335
+ def test_generative_error(self):
336
+ class FooTC(TestCase):
337
+ def test_generative(self):
338
+ for i in xrange(10):
339
+ if i == 5:
340
+ raise ValueError('STOP !')
341
+ yield self.assertEquals, i, i
342
+
343
+ result = self.runner.run(FooTC('test_generative'))
344
+ self.assertEquals(result.testsRun, 5)
345
+ self.assertEquals(len(result.failures), 0)
346
+ self.assertEquals(len(result.errors), 1)
347
+
348
+ def test_generative_error2(self):
349
+ class FooTC(TestCase):
350
+ def test_generative(self):
351
+ for i in xrange(10):
352
+ if i == 5:
353
+ yield self.ouch
354
+ yield self.assertEquals, i, i
355
+ def ouch(self): raise ValueError('stop !')
356
+ result = self.runner.run(FooTC('test_generative'))
357
+ self.assertEquals(result.testsRun, 6)
358
+ self.assertEquals(len(result.failures), 0)
359
+ self.assertEquals(len(result.errors), 1)
360
+
361
+
362
+ def test_generative_setup(self):
363
+ class FooTC(TestCase):
364
+ def setUp(self):
365
+ raise ValueError('STOP !')
366
+ def test_generative(self):
367
+ for i in xrange(10):
368
+ yield self.assertEquals, i, i
369
+
370
+ result = self.runner.run(FooTC('test_generative'))
371
+ self.assertEquals(result.testsRun, 1)
372
+ self.assertEquals(len(result.failures), 0)
373
+ self.assertEquals(len(result.errors), 1)
374
+
375
+ def test_generative_inner_skip(self):
376
+ class FooTC(TestCase):
377
+ def check(self, val):
378
+ if val == 5:
379
+ self.innerSkip("no 5")
380
+ else:
381
+ self.assertEquals(val, val)
382
+
383
+ def test_generative(self):
384
+ for i in xrange(10):
385
+ yield InnerTest("check_%s"%i, self.check, i)
386
+
387
+ result = self.runner.run(FooTC('test_generative'))
388
+ self.assertEquals(result.testsRun, 10)
389
+ self.assertEquals(len(result.failures), 0)
390
+ self.assertEquals(len(result.errors), 0)
391
+ self.assertEquals(len(result.skipped), 1)
392
+
393
+ def test_generative_skip(self):
394
+ class FooTC(TestCase):
395
+ def check(self, val):
396
+ if val == 5:
397
+ self.skip("no 5")
398
+ else:
399
+ self.assertEquals(val, val)
400
+
401
+ def test_generative(self):
402
+ for i in xrange(10):
403
+ yield InnerTest("check_%s"%i, self.check, i)
404
+
405
+ result = self.runner.run(FooTC('test_generative'))
406
+ self.assertEquals(result.testsRun, 6)
407
+ self.assertEquals(len(result.failures), 0)
408
+ self.assertEquals(len(result.errors), 0)
409
+ self.assertEquals(len(result.skipped), 1)
410
+
411
+ def test_generative_inner_error(self):
412
+ class FooTC(TestCase):
413
+ def check(self, val):
414
+ if val == 5:
415
+ raise ValueError("no 5")
416
+ else:
417
+ self.assertEquals(val, val)
418
+
419
+ def test_generative(self):
420
+ for i in xrange(10):
421
+ yield InnerTest("check_%s"%i, self.check, i)
422
+
423
+ result = self.runner.run(FooTC('test_generative'))
424
+ self.assertEquals(result.testsRun, 6)
425
+ self.assertEquals(len(result.failures), 0)
426
+ self.assertEquals(len(result.errors), 1)
427
+ self.assertEquals(len(result.skipped), 0)
428
+
429
+ def test_generative_inner_failure(self):
430
+ class FooTC(TestCase):
431
+ def check(self, val):
432
+ if val == 5:
433
+ self.assertEquals(val, val+1)
434
+ else:
435
+ self.assertEquals(val, val)
436
+
437
+ def test_generative(self):
438
+ for i in xrange(10):
439
+ yield InnerTest("check_%s"%i, self.check, i)
440
+
441
+ result = self.runner.run(FooTC('test_generative'))
442
+ self.assertEquals(result.testsRun, 10)
443
+ self.assertEquals(len(result.failures), 1)
444
+ self.assertEquals(len(result.errors), 0)
445
+ self.assertEquals(len(result.skipped), 0)
446
+
447
+
448
+ class ExitFirstTC(TestCase):
449
+ def setUp(self):
450
+ output = StringIO()
451
+ self.runner = SkipAwareTextTestRunner(stream=output, exitfirst=True)
452
+
453
+ def test_failure_exit_first(self):
454
+ class FooTC(TestCase):
455
+ def test_1(self): pass
456
+ def test_2(self): assert False
457
+ def test_3(self): pass
458
+ tests = [FooTC('test_1'), FooTC('test_2')]
459
+ result = self.runner.run(TestSuite(tests))
460
+ self.assertEquals(result.testsRun, 2)
461
+ self.assertEquals(len(result.failures), 1)
462
+ self.assertEquals(len(result.errors), 0)
463
+
464
+
465
+ def test_error_exit_first(self):
466
+ class FooTC(TestCase):
467
+ def test_1(self): pass
468
+ def test_2(self): raise ValueError()
469
+ def test_3(self): pass
470
+ tests = [FooTC('test_1'), FooTC('test_2'), FooTC('test_3')]
471
+ result = self.runner.run(TestSuite(tests))
472
+ self.assertEquals(result.testsRun, 2)
473
+ self.assertEquals(len(result.failures), 0)
474
+ self.assertEquals(len(result.errors), 1)
475
+
476
+ def test_generative_exit_first(self):
477
+ class FooTC(TestCase):
478
+ def test_generative(self):
479
+ for i in xrange(10):
480
+ yield self.assert_, False
481
+ result = self.runner.run(FooTC('test_generative'))
482
+ self.assertEquals(result.testsRun, 1)
483
+ self.assertEquals(len(result.failures), 1)
484
+ self.assertEquals(len(result.errors), 0)
485
+
486
+
487
+ class TestLoaderTC(TestCase):
488
+ ## internal classes for test purposes ########
489
+ class FooTC(TestCase):
490
+ def test_foo1(self): pass
491
+ def test_foo2(self): pass
492
+ def test_bar1(self): pass
493
+
494
+ class BarTC(TestCase):
495
+ def test_bar2(self): pass
496
+ ##############################################
497
+
498
+ def setUp(self):
499
+ self.loader = NonStrictTestLoader()
500
+ self.module = TestLoaderTC # mock_object(FooTC=TestLoaderTC.FooTC, BarTC=TestLoaderTC.BarTC)
501
+ self.output = StringIO()
502
+ self.runner = SkipAwareTextTestRunner(stream=self.output)
503
+
504
+ def assertRunCount(self, pattern, module, expected_count, skipped=()):
505
+ if pattern:
506
+ suite = self.loader.loadTestsFromNames([pattern], module)
507
+ else:
508
+ suite = self.loader.loadTestsFromModule(module)
509
+ self.runner.test_pattern = pattern
510
+ self.runner.skipped_patterns = skipped
511
+ result = self.runner.run(suite)
512
+ self.runner.test_pattern = None
513
+ self.runner.skipped_patterns = ()
514
+ self.assertEquals(result.testsRun, expected_count)
515
+
516
+ def test_collect_everything(self):
517
+ """make sure we don't change the default behaviour
518
+ for loadTestsFromModule() and loadTestsFromTestCase
519
+ """
520
+ testsuite = self.loader.loadTestsFromModule(self.module)
521
+ self.assertEquals(len(testsuite._tests), 2)
522
+ suite1, suite2 = testsuite._tests
523
+ self.assertEquals(len(suite1._tests) + len(suite2._tests), 4)
524
+
525
+ def test_collect_with_classname(self):
526
+ self.assertRunCount('FooTC', self.module, 3)
527
+ self.assertRunCount('BarTC', self.module, 1)
528
+
529
+ def test_collect_with_classname_and_pattern(self):
530
+ data = [('FooTC.test_foo1', 1), ('FooTC.test_foo', 2), ('FooTC.test_fo', 2),
531
+ ('FooTC.foo1', 1), ('FooTC.foo', 2), ('FooTC.whatever', 0)
532
+ ]
533
+ for pattern, expected_count in data:
534
+ yield self.assertRunCount, pattern, self.module, expected_count
535
+
536
+ def test_collect_with_pattern(self):
537
+ data = [('test_foo1', 1), ('test_foo', 2), ('test_bar', 2),
538
+ ('foo1', 1), ('foo', 2), ('bar', 2), ('ba', 2),
539
+ ('test', 4), ('ab', 0),
540
+ ]
541
+ for pattern, expected_count in data:
542
+ yield self.assertRunCount, pattern, self.module, expected_count
543
+
544
+ def test_tescase_with_custom_metaclass(self):
545
+ class mymetaclass(type): pass
546
+ class MyMod:
547
+ class MyTestCase(TestCase):
548
+ __metaclass__ = mymetaclass
549
+ def test_foo1(self): pass
550
+ def test_foo2(self): pass
551
+ def test_bar(self): pass
552
+ data = [('test_foo1', 1), ('test_foo', 2), ('test_bar', 1),
553
+ ('foo1', 1), ('foo', 2), ('bar', 1), ('ba', 1),
554
+ ('test', 3), ('ab', 0),
555
+ ('MyTestCase.test_foo1', 1), ('MyTestCase.test_foo', 2),
556
+ ('MyTestCase.test_fo', 2), ('MyTestCase.foo1', 1),
557
+ ('MyTestCase.foo', 2), ('MyTestCase.whatever', 0)
558
+ ]
559
+ for pattern, expected_count in data:
560
+ yield self.assertRunCount, pattern, MyMod, expected_count
561
+
562
+
563
+ def test_collect_everything_and_skipped_patterns(self):
564
+ testdata = [ (['foo1'], 3), (['foo'], 2),
565
+ (['foo', 'bar'], 0),
566
+ ]
567
+ for skipped, expected_count in testdata:
568
+ yield self.assertRunCount, None, self.module, expected_count, skipped
569
+
570
+
571
+ def test_collect_specific_pattern_and_skip_some(self):
572
+ testdata = [ ('bar', ['foo1'], 2), ('bar', [], 2),
573
+ ('bar', ['bar'], 0), ]
574
+
575
+ for runpattern, skipped, expected_count in testdata:
576
+ yield self.assertRunCount, runpattern, self.module, expected_count, skipped
577
+
578
+ def test_skip_classname(self):
579
+ testdata = [ (['BarTC'], 3), (['FooTC'], 1), ]
580
+ for skipped, expected_count in testdata:
581
+ yield self.assertRunCount, None, self.module, expected_count, skipped
582
+
583
+ def test_skip_classname_and_specific_collect(self):
584
+ testdata = [ ('bar', ['BarTC'], 1), ('foo', ['FooTC'], 0), ]
585
+ for runpattern, skipped, expected_count in testdata:
586
+ yield self.assertRunCount, runpattern, self.module, expected_count, skipped
587
+
588
+
589
+ def test_nonregr_dotted_path(self):
590
+ self.assertRunCount('FooTC.test_foo', self.module, 2)
591
+
592
+
593
+ def test_inner_tests_selection(self):
594
+ class MyMod:
595
+ class MyTestCase(TestCase):
596
+ def test_foo(self): pass
597
+ def test_foobar(self):
598
+ for i in xrange(5):
599
+ if i%2 == 0:
600
+ yield InnerTest('even', lambda: None)
601
+ else:
602
+ yield InnerTest('odd', lambda: None)
603
+ yield lambda: None
604
+
605
+ data = [('foo', 7), ('test_foobar', 6), ('even', 3), ('odd', 2),
606
+ ]
607
+ for pattern, expected_count in data:
608
+ yield self.assertRunCount, pattern, MyMod, expected_count
609
+
610
+ def test_nonregr_class_skipped_option(self):
611
+ class MyMod:
612
+ class MyTestCase(TestCase):
613
+ def test_foo(self): pass
614
+ def test_bar(self): pass
615
+ class FooTC(TestCase):
616
+ def test_foo(self): pass
617
+ self.assertRunCount('foo', MyMod, 2)
618
+ self.assertRunCount(None, MyMod, 3)
619
+ self.loader.skipped_patterns = self.runner.skipped_patterns = ['FooTC']
620
+ self.assertRunCount('foo', MyMod, 1)
621
+ self.assertRunCount(None, MyMod, 2)
622
+
623
+ def test__classes_are_ignored(self):
624
+ class MyMod:
625
+ class _Base(TestCase):
626
+ def test_1(self): pass
627
+ class MyTestCase(_Base):
628
+ def test_2(self): pass
629
+ self.assertRunCount(None, MyMod, 2)
630
+
631
+
632
+ def bootstrap_print(msg, output=sys.stdout):
633
+ """sys.stdout will be evaluated at function parsing time"""
634
+ # print msg
635
+ output.write(msg)
636
+
637
+ class OutErrCaptureTC(TestCase):
638
+
639
+ def setUp(self):
640
+ sys.stdout = sys.stderr = StringIO()
641
+ self.runner = SkipAwareTextTestRunner(stream=StringIO(), exitfirst=True, capture=True)
642
+
643
+ def tearDown(self):
644
+ sys.stdout = sys.__stdout__
645
+ sys.stderr = sys.__stderr__
646
+
647
+ def test_stdout_capture(self):
648
+ class FooTC(TestCase):
649
+ def test_stdout(self):
650
+ print "foo"
651
+ self.assert_(False)
652
+ test = FooTC('test_stdout')
653
+ result = self.runner.run(test)
654
+ captured_out, captured_err = test.captured_output()
655
+ self.assertEqual(captured_out.strip(), "foo")
656
+ self.assertEqual(captured_err.strip(), "")
657
+
658
+ def test_stderr_capture(self):
659
+ class FooTC(TestCase):
660
+ def test_stderr(self):
661
+ print >> sys.stderr, "foo"
662
+ self.assert_(False)
663
+ test = FooTC('test_stderr')
664
+ result = self.runner.run(test)
665
+ captured_out, captured_err = test.captured_output()
666
+ self.assertEqual(captured_out.strip(), "")
667
+ self.assertEqual(captured_err.strip(), "foo")
668
+
669
+
670
+ def test_both_capture(self):
671
+ class FooTC(TestCase):
672
+ def test_stderr(self):
673
+ print >> sys.stderr, "foo"
674
+ print "bar"
675
+ self.assert_(False)
676
+ test = FooTC('test_stderr')
677
+ result = self.runner.run(test)
678
+ captured_out, captured_err = test.captured_output()
679
+ self.assertEqual(captured_out.strip(), "bar")
680
+ self.assertEqual(captured_err.strip(), "foo")
681
+
682
+ def test_no_capture(self):
683
+ class FooTC(TestCase):
684
+ def test_stderr(self):
685
+ print >> sys.stderr, "foo"
686
+ print "bar"
687
+ self.assert_(False)
688
+ test = FooTC('test_stderr')
689
+ # this runner should not capture stdout / stderr
690
+ runner = SkipAwareTextTestRunner(stream=StringIO(), exitfirst=True)
691
+ result = runner.run(test)
692
+ captured_out, captured_err = test.captured_output()
693
+ self.assertEqual(captured_out.strip(), "")
694
+ self.assertEqual(captured_err.strip(), "")
695
+
696
+
697
+ def test_capture_core(self):
698
+ # output = capture_stdout()
699
+ # bootstrap_print("hello", output=sys.stdout)
700
+ # self.assertEquals(output.restore(), "hello")
701
+ output = capture_stdout()
702
+ bootstrap_print("hello")
703
+ self.assertEquals(output.restore(), "hello")
704
+
705
+ def test_unicode_non_ascii_messages(self):
706
+ class FooTC(TestCase):
707
+ def test_xxx(self):
708
+ raise Exception(u'\xe9')
709
+ test = FooTC('test_xxx')
710
+ # run the test and make sure testlib doesn't raise an exception
711
+ result = self.runner.run(test)
712
+
713
+ def test_encoded_non_ascii_messages(self):
714
+ class FooTC(TestCase):
715
+ def test_xxx(self):
716
+ raise Exception('\xe9')
717
+ test = FooTC('test_xxx')
718
+ # run the test and make sure testlib doesn't raise an exception
719
+ result = self.runner.run(test)
720
+
721
+
722
+ class DecoratorTC(TestCase):
723
+
724
+ @with_tempdir
725
+ def test_tmp_dir_normal(self):
726
+
727
+
728
+ tempdir = tempfile.gettempdir()
729
+ # assert temp directory is empty
730
+ self.assertListEquals(list(os.walk(tempdir)),
731
+ [(tempdir,[],[])])
732
+
733
+ witness = []
734
+
735
+ @with_tempdir
736
+ def createfile(list):
737
+ fd1, fn1 = tempfile.mkstemp()
738
+ fd2, fn2 = tempfile.mkstemp()
739
+ dir = tempfile.mkdtemp()
740
+ fd3, fn3 = tempfile.mkstemp(dir=dir)
741
+ tempfile.mkdtemp()
742
+ list.append(True)
743
+ for fd in (fd1, fd2, fd3):
744
+ os.close(fd)
745
+
746
+ self.assertFalse(witness)
747
+ createfile(witness)
748
+ self.assertTrue(witness)
749
+
750
+ self.assertEquals(tempfile.gettempdir(), tempdir)
751
+
752
+ # assert temp directory is empty
753
+ self.assertListEquals(list(os.walk(tempdir)),
754
+ [(tempdir,[],[])])
755
+
756
+ @with_tempdir
757
+ def test_tmp_dir_normal(self):
758
+
759
+ tempdir = tempfile.gettempdir()
760
+ # assert temp directory is empty
761
+ self.assertListEquals(list(os.walk(tempfile.tempdir)),
762
+ [(tempfile.tempdir,[],[])])
763
+
764
+
765
+ class WitnessException(Exception):
766
+ pass
767
+
768
+ @with_tempdir
769
+ def createfile():
770
+ fd1, fn1 = tempfile.mkstemp()
771
+ fd2, fn2 = tempfile.mkstemp()
772
+ dir = tempfile.mkdtemp()
773
+ fd3, fn3 = tempfile.mkstemp(dir=dir)
774
+ tempfile.mkdtemp()
775
+ for fd in (fd1, fd2, fd3):
776
+ os.close(fd)
777
+ raise WitnessException()
778
+
779
+ self.assertRaises(WitnessException, createfile)
780
+
781
+
782
+ # assert tempdir didn't change
783
+ self.assertEquals(tempfile.gettempdir(), tempdir)
784
+
785
+ # assert temp directory is empty
786
+ self.assertListEquals(list(os.walk(tempdir)),
787
+ [(tempdir,[],[])])
788
+
789
+
790
+ def setUp(self):
791
+ self.pyversion = sys.version_info
792
+
793
+ def tearDown(self):
794
+ sys.version_info = self.pyversion
795
+
796
+ def test_require_version_good(self):
797
+ """ should return the same function
798
+ """
799
+ def func() :
800
+ pass
801
+ sys.version_info = (2, 5, 5, 'final', 4)
802
+ current = sys.version_info[:3]
803
+ compare = ('2.4', '2.5', '2.5.4', '2.5.5')
804
+ for version in compare:
805
+ decorator = require_version(version)
806
+ self.assertEquals(func, decorator(func), '%s =< %s : function \
807
+ return by the decorator should be the same.' % (version,
808
+ '.'.join([str(element) for element in current])))
809
+
810
+ def test_require_version_bad(self):
811
+ """ should return a different function : skipping test
812
+ """
813
+ def func() :
814
+ pass
815
+ sys.version_info = (2, 5, 5, 'final', 4)
816
+ current = sys.version_info[:3]
817
+ compare = ('2.5.6', '2.6', '2.6.5')
818
+ for version in compare:
819
+ decorator = require_version(version)
820
+ self.assertNotEquals(func, decorator(func), '%s >= %s : function \
821
+ return by the decorator should NOT be the same.'
822
+ % ('.'.join([str(element) for element in current]), version))
823
+
824
+ def test_require_version_exception(self):
825
+ """ should throw a ValueError exception
826
+ """
827
+ def func() :
828
+ pass
829
+ compare = ('2.5.a', '2.a', 'azerty')
830
+ for version in compare:
831
+ decorator = require_version(version)
832
+ self.assertRaises(ValueError, decorator, func)
833
+
834
+ def test_require_module_good(self):
835
+ """ should return the same function
836
+ """
837
+ def func() :
838
+ pass
839
+ module = 'sys'
840
+ decorator = require_module(module)
841
+ self.assertEquals(func, decorator(func), 'module %s exists : function \
842
+ return by the decorator should be the same.' % module)
843
+
844
+ def test_require_module_bad(self):
845
+ """ should return a different function : skipping test
846
+ """
847
+ def func() :
848
+ pass
849
+ modules = ('bla', 'blo', 'bli')
850
+ for module in modules:
851
+ try:
852
+ __import__(module)
853
+ pass
854
+ except ImportError:
855
+ decorator = require_module(module)
856
+ self.assertNotEquals(func, decorator(func), 'module %s does \
857
+ not exist : function return by the decorator should \
858
+ NOT be the same.' % module)
859
+ return
860
+ print 'all modules in %s exist. Could not test %s' % (', '.join(modules),
861
+ sys._getframe().f_code.co_name)
862
+
863
+ class TagTC(TestCase):
864
+
865
+ def setUp(self):
866
+ @tag('testing', 'bob')
867
+ def bob(a, b, c):
868
+ return (a + b) * c
869
+
870
+ self.func = bob
871
+
872
+ class TagTestTC(TestCase):
873
+ tags = Tags(('one', 'two'))
874
+
875
+ def test_one(self):
876
+ self.assertTrue(True)
877
+
878
+ @tag('two', 'three')
879
+ def test_two(self):
880
+ self.assertTrue(True)
881
+
882
+ @tag('three')
883
+ def test_three(self):
884
+ self.assertTrue(True)
885
+ self.cls = TagTestTC
886
+
887
+ def test_tag_decorator(self):
888
+ bob = self.func
889
+
890
+ self.assertEquals(bob(2, 3, 7), 35)
891
+ self.assertTrue(hasattr(bob, 'tags'))
892
+ self.assertSetEquals(bob.tags, set(['testing','bob']))
893
+
894
+
895
+ def test_tags_class(self):
896
+ tags = self.func.tags
897
+
898
+ self.assertTrue(tags['testing'])
899
+ self.assertFalse(tags['Not inside'])
900
+
901
+ def test_tags_match(self):
902
+ tags = self.func.tags
903
+
904
+ self.assertTrue(tags.match('testing'))
905
+ self.assertFalse(tags.match('other'))
906
+
907
+ self.assertFalse(tags.match('testing and coin'))
908
+ self.assertTrue(tags.match('testing or other'))
909
+
910
+ self.assertTrue(tags.match('not other'))
911
+
912
+ self.assertTrue(tags.match('not other or (testing and bibi)'))
913
+ self.assertTrue(tags.match('other or (testing and bob)'))
914
+
915
+ def test_tagged_class(self):
916
+ def options(tags):
917
+ class Options(object):
918
+ tags_pattern = tags
919
+ return Options()
920
+
921
+ cls = self.cls
922
+
923
+ runner = SkipAwareTextTestRunner()
924
+ self.assertTrue(runner.does_match_tags(cls.test_one))
925
+ self.assertTrue(runner.does_match_tags(cls.test_two))
926
+ self.assertTrue(runner.does_match_tags(cls.test_three))
927
+
928
+ runner = SkipAwareTextTestRunner(options=options('one'))
929
+ self.assertTrue(runner.does_match_tags(cls.test_one))
930
+ self.assertFalse(runner.does_match_tags(cls.test_two))
931
+ self.assertFalse(runner.does_match_tags(cls.test_three))
932
+
933
+ runner = SkipAwareTextTestRunner(options=options('two'))
934
+ self.assertTrue(runner.does_match_tags(cls.test_one))
935
+ self.assertTrue(runner.does_match_tags(cls.test_two))
936
+ self.assertFalse(runner.does_match_tags(cls.test_three))
937
+
938
+ runner = SkipAwareTextTestRunner(options=options('three'))
939
+ self.assertFalse(runner.does_match_tags(cls.test_one))
940
+ self.assertTrue(runner.does_match_tags(cls.test_two))
941
+ self.assertTrue(runner.does_match_tags(cls.test_three))
942
+
943
+ runner = SkipAwareTextTestRunner(options=options('two or three'))
944
+ self.assertTrue(runner.does_match_tags(cls.test_one))
945
+ self.assertTrue(runner.does_match_tags(cls.test_two))
946
+ self.assertTrue(runner.does_match_tags(cls.test_three))
947
+
948
+ runner = SkipAwareTextTestRunner(options=options('two and three'))
949
+ self.assertFalse(runner.does_match_tags(cls.test_one))
950
+ self.assertTrue(runner.does_match_tags(cls.test_two))
951
+ self.assertFalse(runner.does_match_tags(cls.test_three))
952
+
953
+
954
+
955
+ if __name__ == '__main__':
956
+ unittest_main()