bee_python 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{build/README → README} +1 -1
- data/egg/egg/build.yml +11 -49
- data/egg/egg.yml +19 -27
- data/egg/http/build.erb +32 -36
- data/egg/http/libhttp.py +102 -0
- data/egg/http/pylint.cfg +236 -0
- data/egg/http/server.py +7 -0
- data/egg/http/test.erb +32 -0
- data/egg/http.yml +33 -29
- data/egg/mysql/mysql.py +8 -9
- data/egg/project/build.erb +21 -53
- data/egg/project/pylint.cfg +236 -0
- data/egg/project/test.py +2 -2
- data/egg/project.yml +23 -31
- data/egg/script/build.erb +18 -23
- data/egg/script/pylint.cfg +236 -0
- data/egg/script.yml +22 -18
- data/egg/source/source.py +6 -6
- data/egg/test/test.py +1 -1
- data/lib/bee_task_python.rb +3 -34
- data/python.yml +123 -0
- metadata +61 -503
- data/test/build.yml +0 -16
- data/test/tc_bee_task_python.rb +0 -27
- data/test/test_build.rb +0 -26
- data/test/test_build_listener.rb +0 -110
- data/test/ts_bee_python.rb +0 -26
- data/tools/common/__init__.py +0 -5
- data/tools/common/common/__init__.py +0 -140
- data/tools/common/common/__pkginfo__.py +0 -43
- data/tools/common/common/adbh.py +0 -35
- data/tools/common/common/cache.py +0 -114
- data/tools/common/common/changelog.py +0 -234
- data/tools/common/common/clcommands.py +0 -181
- data/tools/common/common/cli.py +0 -212
- data/tools/common/common/compat.py +0 -328
- data/tools/common/common/configuration.py +0 -1087
- data/tools/common/common/contexts.py +0 -58
- data/tools/common/common/corbautils.py +0 -117
- data/tools/common/common/daemon.py +0 -171
- data/tools/common/common/date.py +0 -279
- data/tools/common/common/db.py +0 -49
- data/tools/common/common/dbf.py +0 -229
- data/tools/common/common/debugger.py +0 -208
- data/tools/common/common/decorators.py +0 -190
- data/tools/common/common/deprecation.py +0 -118
- data/tools/common/common/fileutils.py +0 -409
- data/tools/common/common/graph.py +0 -259
- data/tools/common/common/html.py +0 -142
- data/tools/common/common/interface.py +0 -76
- data/tools/common/common/logging_ext.py +0 -166
- data/tools/common/common/modutils.py +0 -670
- data/tools/common/common/optik_ext.py +0 -383
- data/tools/common/common/optparser.py +0 -92
- data/tools/common/common/pdf_ext.py +0 -111
- data/tools/common/common/proc.py +0 -276
- data/tools/common/common/pyro_ext.py +0 -146
- data/tools/common/common/pytest.py +0 -754
- data/tools/common/common/shellutils.py +0 -383
- data/tools/common/common/sphinx_ext.py +0 -87
- data/tools/common/common/sphinxutils.py +0 -122
- data/tools/common/common/sqlgen.py +0 -31
- data/tools/common/common/table.py +0 -930
- data/tools/common/common/tasksqueue.py +0 -97
- data/tools/common/common/test/__init__.py +0 -1
- data/tools/common/common/test/data/ChangeLog +0 -184
- data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/common/common/test/data/__init__.py +0 -1
- data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/content_differ_dir/README +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/file_differ_dir/README +0 -1
- data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/common/common/test/data/find_test/__init__.py +0 -0
- data/tools/common/common/test/data/find_test/foo.txt +0 -0
- data/tools/common/common/test/data/find_test/module.py +0 -0
- data/tools/common/common/test/data/find_test/module2.py +0 -0
- data/tools/common/common/test/data/find_test/newlines.txt +0 -0
- data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/common/common/test/data/find_test/nonregr.py +0 -0
- data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/common/common/test/data/find_test/spam.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/common/common/test/data/find_test/test.ini +0 -0
- data/tools/common/common/test/data/find_test/test1.msg +0 -0
- data/tools/common/common/test/data/find_test/test2.msg +0 -0
- data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/common/common/test/data/foo.txt +0 -9
- data/tools/common/common/test/data/module.py +0 -88
- data/tools/common/common/test/data/module2.py +0 -77
- data/tools/common/common/test/data/newlines.txt +0 -3
- data/tools/common/common/test/data/noendingnewline.py +0 -36
- data/tools/common/common/test/data/nonregr.py +0 -14
- data/tools/common/common/test/data/normal_file.txt +0 -0
- data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/common/common/test/data/reference_dir/README +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/same_dir/NOTHING +0 -0
- data/tools/common/common/test/data/same_dir/README +0 -1
- data/tools/common/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/spam.txt +0 -9
- data/tools/common/common/test/data/sub/doc.txt +0 -1
- data/tools/common/common/test/data/sub/momo.py +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/test.ini +0 -20
- data/tools/common/common/test/data/test1.msg +0 -30
- data/tools/common/common/test/data/test2.msg +0 -42
- data/tools/common/common/test/data/write_protected_file.txt +0 -0
- data/tools/common/common/test/foomod.py +0 -17
- data/tools/common/common/test/unittest_cache.py +0 -129
- data/tools/common/common/test/unittest_changelog.py +0 -37
- data/tools/common/common/test/unittest_compat.py +0 -239
- data/tools/common/common/test/unittest_configuration.py +0 -348
- data/tools/common/common/test/unittest_date.py +0 -154
- data/tools/common/common/test/unittest_decorators.py +0 -62
- data/tools/common/common/test/unittest_deprecation.py +0 -76
- data/tools/common/common/test/unittest_fileutils.py +0 -133
- data/tools/common/common/test/unittest_graph.py +0 -50
- data/tools/common/common/test/unittest_html.py +0 -76
- data/tools/common/common/test/unittest_interface.py +0 -87
- data/tools/common/common/test/unittest_modutils.py +0 -244
- data/tools/common/common/test/unittest_pytest.py +0 -50
- data/tools/common/common/test/unittest_shellutils.py +0 -248
- data/tools/common/common/test/unittest_table.py +0 -448
- data/tools/common/common/test/unittest_taskqueue.py +0 -71
- data/tools/common/common/test/unittest_testlib.py +0 -956
- data/tools/common/common/test/unittest_textutils.py +0 -247
- data/tools/common/common/test/unittest_tree.py +0 -248
- data/tools/common/common/test/unittest_umessage.py +0 -55
- data/tools/common/common/test/unittest_ureports_html.py +0 -64
- data/tools/common/common/test/unittest_ureports_text.py +0 -105
- data/tools/common/common/test/unittest_xmlutils.py +0 -75
- data/tools/common/common/test/utils.py +0 -87
- data/tools/common/common/testlib.py +0 -1927
- data/tools/common/common/textutils.py +0 -476
- data/tools/common/common/tree.py +0 -372
- data/tools/common/common/umessage.py +0 -161
- data/tools/common/common/ureports/__init__.py +0 -174
- data/tools/common/common/ureports/docbook_writer.py +0 -139
- data/tools/common/common/ureports/html_writer.py +0 -131
- data/tools/common/common/ureports/nodes.py +0 -201
- data/tools/common/common/ureports/text_writer.py +0 -140
- data/tools/common/common/vcgutils.py +0 -216
- data/tools/common/common/visitor.py +0 -107
- data/tools/common/common/xmlrpcutils.py +0 -136
- data/tools/common/common/xmlutils.py +0 -61
- data/tools/coverage/coverage.py +0 -602
- data/tools/epydoc/__init__.py +0 -227
- data/tools/epydoc/__init__.pyc +0 -0
- data/tools/epydoc/apidoc.py +0 -2203
- data/tools/epydoc/apidoc.pyc +0 -0
- data/tools/epydoc/checker.py +0 -349
- data/tools/epydoc/checker.pyc +0 -0
- data/tools/epydoc/cli.py +0 -1470
- data/tools/epydoc/cli.pyc +0 -0
- data/tools/epydoc/compat.py +0 -250
- data/tools/epydoc/compat.pyc +0 -0
- data/tools/epydoc/docbuilder.py +0 -1358
- data/tools/epydoc/docbuilder.pyc +0 -0
- data/tools/epydoc/docintrospecter.py +0 -1056
- data/tools/epydoc/docintrospecter.pyc +0 -0
- data/tools/epydoc/docparser.py +0 -2113
- data/tools/epydoc/docparser.pyc +0 -0
- data/tools/epydoc/docstringparser.py +0 -1111
- data/tools/epydoc/docstringparser.pyc +0 -0
- data/tools/epydoc/docwriter/__init__.py +0 -12
- data/tools/epydoc/docwriter/__init__.pyc +0 -0
- data/tools/epydoc/docwriter/dotgraph.py +0 -1351
- data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
- data/tools/epydoc/docwriter/html.py +0 -3491
- data/tools/epydoc/docwriter/html.pyc +0 -0
- data/tools/epydoc/docwriter/html_colorize.py +0 -909
- data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
- data/tools/epydoc/docwriter/html_css.py +0 -550
- data/tools/epydoc/docwriter/html_css.pyc +0 -0
- data/tools/epydoc/docwriter/html_help.py +0 -190
- data/tools/epydoc/docwriter/html_help.pyc +0 -0
- data/tools/epydoc/docwriter/latex.py +0 -1187
- data/tools/epydoc/docwriter/latex.pyc +0 -0
- data/tools/epydoc/docwriter/plaintext.py +0 -276
- data/tools/epydoc/docwriter/plaintext.pyc +0 -0
- data/tools/epydoc/docwriter/xlink.py +0 -505
- data/tools/epydoc/docwriter/xlink.pyc +0 -0
- data/tools/epydoc/gui.py +0 -1148
- data/tools/epydoc/gui.pyc +0 -0
- data/tools/epydoc/log.py +0 -204
- data/tools/epydoc/log.pyc +0 -0
- data/tools/epydoc/markup/__init__.py +0 -623
- data/tools/epydoc/markup/__init__.pyc +0 -0
- data/tools/epydoc/markup/doctest.py +0 -311
- data/tools/epydoc/markup/doctest.pyc +0 -0
- data/tools/epydoc/markup/epytext.py +0 -2116
- data/tools/epydoc/markup/epytext.pyc +0 -0
- data/tools/epydoc/markup/javadoc.py +0 -250
- data/tools/epydoc/markup/javadoc.pyc +0 -0
- data/tools/epydoc/markup/plaintext.py +0 -78
- data/tools/epydoc/markup/plaintext.pyc +0 -0
- data/tools/epydoc/markup/pyval_repr.py +0 -532
- data/tools/epydoc/markup/pyval_repr.pyc +0 -0
- data/tools/epydoc/markup/restructuredtext.py +0 -906
- data/tools/epydoc/markup/restructuredtext.pyc +0 -0
- data/tools/epydoc/test/__init__.py +0 -97
- data/tools/epydoc/test/__init__.pyc +0 -0
- data/tools/epydoc/test/util.py +0 -226
- data/tools/epydoc/test/util.pyc +0 -0
- data/tools/epydoc/util.py +0 -289
- data/tools/epydoc/util.pyc +0 -0
- data/tools/logilab/logilab/__init__.py +0 -5
- data/tools/logilab/logilab/astng/__init__.py +0 -82
- data/tools/logilab/logilab/astng/__pkginfo__.py +0 -76
- data/tools/logilab/logilab/astng/_exceptions.py +0 -64
- data/tools/logilab/logilab/astng/_nodes_ast.py +0 -667
- data/tools/logilab/logilab/astng/_nodes_compiler.py +0 -758
- data/tools/logilab/logilab/astng/bases.py +0 -608
- data/tools/logilab/logilab/astng/builder.py +0 -239
- data/tools/logilab/logilab/astng/inference.py +0 -426
- data/tools/logilab/logilab/astng/inspector.py +0 -289
- data/tools/logilab/logilab/astng/manager.py +0 -421
- data/tools/logilab/logilab/astng/mixins.py +0 -165
- data/tools/logilab/logilab/astng/node_classes.py +0 -848
- data/tools/logilab/logilab/astng/nodes.py +0 -85
- data/tools/logilab/logilab/astng/nodes_as_string.py +0 -389
- data/tools/logilab/logilab/astng/patchcomptransformer.py +0 -159
- data/tools/logilab/logilab/astng/protocols.py +0 -333
- data/tools/logilab/logilab/astng/raw_building.py +0 -212
- data/tools/logilab/logilab/astng/rebuilder.py +0 -307
- data/tools/logilab/logilab/astng/scoped_nodes.py +0 -951
- data/tools/logilab/logilab/astng/test/__init__.py +0 -19
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
- data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +0 -33
- data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/all.py +0 -29
- data/tools/logilab/logilab/astng/test/data/appl/__init__.py +0 -23
- data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +0 -30
- data/tools/logilab/logilab/astng/test/data/format.py +0 -34
- data/tools/logilab/logilab/astng/test/data/module.py +0 -90
- data/tools/logilab/logilab/astng/test/data/module2.py +0 -112
- data/tools/logilab/logilab/astng/test/data/noendingnewline.py +0 -57
- data/tools/logilab/logilab/astng/test/data/nonregr.py +0 -76
- data/tools/logilab/logilab/astng/test/data/notall.py +0 -28
- data/tools/logilab/logilab/astng/test/data2/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +0 -51
- data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +0 -32
- data/tools/logilab/logilab/astng/test/regrtest.py +0 -135
- data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +0 -22
- data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +0 -31
- data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +0 -68
- data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +0 -24
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +0 -20
- data/tools/logilab/logilab/astng/test/unittest_builder.py +0 -684
- data/tools/logilab/logilab/astng/test/unittest_inference.py +0 -1112
- data/tools/logilab/logilab/astng/test/unittest_inspector.py +0 -105
- data/tools/logilab/logilab/astng/test/unittest_lookup.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_manager.py +0 -98
- data/tools/logilab/logilab/astng/test/unittest_nodes.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +0 -501
- data/tools/logilab/logilab/astng/test/unittest_utils.py +0 -104
- data/tools/logilab/logilab/astng/utils.py +0 -342
- data/tools/logilab/logilab/common/__init__.py +0 -140
- data/tools/logilab/logilab/common/__pkginfo__.py +0 -43
- data/tools/logilab/logilab/common/adbh.py +0 -35
- data/tools/logilab/logilab/common/cache.py +0 -114
- data/tools/logilab/logilab/common/changelog.py +0 -234
- data/tools/logilab/logilab/common/clcommands.py +0 -181
- data/tools/logilab/logilab/common/cli.py +0 -212
- data/tools/logilab/logilab/common/compat.py +0 -328
- data/tools/logilab/logilab/common/configuration.py +0 -1087
- data/tools/logilab/logilab/common/contexts.py +0 -58
- data/tools/logilab/logilab/common/corbautils.py +0 -117
- data/tools/logilab/logilab/common/daemon.py +0 -171
- data/tools/logilab/logilab/common/date.py +0 -279
- data/tools/logilab/logilab/common/db.py +0 -49
- data/tools/logilab/logilab/common/dbf.py +0 -229
- data/tools/logilab/logilab/common/debugger.py +0 -208
- data/tools/logilab/logilab/common/decorators.py +0 -190
- data/tools/logilab/logilab/common/deprecation.py +0 -118
- data/tools/logilab/logilab/common/fileutils.py +0 -409
- data/tools/logilab/logilab/common/graph.py +0 -259
- data/tools/logilab/logilab/common/html.py +0 -142
- data/tools/logilab/logilab/common/interface.py +0 -76
- data/tools/logilab/logilab/common/logging_ext.py +0 -166
- data/tools/logilab/logilab/common/modutils.py +0 -670
- data/tools/logilab/logilab/common/optik_ext.py +0 -383
- data/tools/logilab/logilab/common/optparser.py +0 -92
- data/tools/logilab/logilab/common/pdf_ext.py +0 -111
- data/tools/logilab/logilab/common/proc.py +0 -276
- data/tools/logilab/logilab/common/pyro_ext.py +0 -146
- data/tools/logilab/logilab/common/pytest.py +0 -754
- data/tools/logilab/logilab/common/shellutils.py +0 -383
- data/tools/logilab/logilab/common/sphinx_ext.py +0 -87
- data/tools/logilab/logilab/common/sphinxutils.py +0 -122
- data/tools/logilab/logilab/common/sqlgen.py +0 -31
- data/tools/logilab/logilab/common/table.py +0 -930
- data/tools/logilab/logilab/common/tasksqueue.py +0 -97
- data/tools/logilab/logilab/common/test/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/ChangeLog +0 -184
- data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/common/test/data/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/content_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/file_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/foo.txt +0 -9
- data/tools/logilab/logilab/common/test/data/module.py +0 -88
- data/tools/logilab/logilab/common/test/data/module2.py +0 -77
- data/tools/logilab/logilab/common/test/data/newlines.txt +0 -3
- data/tools/logilab/logilab/common/test/data/noendingnewline.py +0 -36
- data/tools/logilab/logilab/common/test/data/nonregr.py +0 -14
- data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/same_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/spam.txt +0 -9
- data/tools/logilab/logilab/common/test/data/sub/doc.txt +0 -1
- data/tools/logilab/logilab/common/test/data/sub/momo.py +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/test.ini +0 -20
- data/tools/logilab/logilab/common/test/data/test1.msg +0 -30
- data/tools/logilab/logilab/common/test/data/test2.msg +0 -42
- data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/foomod.py +0 -17
- data/tools/logilab/logilab/common/test/unittest_cache.py +0 -129
- data/tools/logilab/logilab/common/test/unittest_changelog.py +0 -37
- data/tools/logilab/logilab/common/test/unittest_compat.py +0 -239
- data/tools/logilab/logilab/common/test/unittest_configuration.py +0 -348
- data/tools/logilab/logilab/common/test/unittest_date.py +0 -154
- data/tools/logilab/logilab/common/test/unittest_decorators.py +0 -62
- data/tools/logilab/logilab/common/test/unittest_deprecation.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_fileutils.py +0 -133
- data/tools/logilab/logilab/common/test/unittest_graph.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_html.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_interface.py +0 -87
- data/tools/logilab/logilab/common/test/unittest_modutils.py +0 -244
- data/tools/logilab/logilab/common/test/unittest_pytest.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_shellutils.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_table.py +0 -448
- data/tools/logilab/logilab/common/test/unittest_taskqueue.py +0 -71
- data/tools/logilab/logilab/common/test/unittest_testlib.py +0 -956
- data/tools/logilab/logilab/common/test/unittest_textutils.py +0 -247
- data/tools/logilab/logilab/common/test/unittest_tree.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_umessage.py +0 -55
- data/tools/logilab/logilab/common/test/unittest_ureports_html.py +0 -64
- data/tools/logilab/logilab/common/test/unittest_ureports_text.py +0 -105
- data/tools/logilab/logilab/common/test/unittest_xmlutils.py +0 -75
- data/tools/logilab/logilab/common/test/utils.py +0 -87
- data/tools/logilab/logilab/common/testlib.py +0 -1927
- data/tools/logilab/logilab/common/textutils.py +0 -476
- data/tools/logilab/logilab/common/tree.py +0 -372
- data/tools/logilab/logilab/common/umessage.py +0 -161
- data/tools/logilab/logilab/common/ureports/__init__.py +0 -174
- data/tools/logilab/logilab/common/ureports/docbook_writer.py +0 -139
- data/tools/logilab/logilab/common/ureports/html_writer.py +0 -131
- data/tools/logilab/logilab/common/ureports/nodes.py +0 -201
- data/tools/logilab/logilab/common/ureports/text_writer.py +0 -140
- data/tools/logilab/logilab/common/vcgutils.py +0 -216
- data/tools/logilab/logilab/common/visitor.py +0 -107
- data/tools/logilab/logilab/common/xmlrpcutils.py +0 -136
- data/tools/logilab/logilab/common/xmlutils.py +0 -61
- data/tools/pychecker/COPYRIGHT +0 -31
- data/tools/pychecker/ChangeLog +0 -349
- data/tools/pychecker/CodeChecks.py +0 -1969
- data/tools/pychecker/CodeChecks.pyc +0 -0
- data/tools/pychecker/CodeChecks.pyo +0 -0
- data/tools/pychecker/Config.py +0 -475
- data/tools/pychecker/Config.pyc +0 -0
- data/tools/pychecker/Config.pyo +0 -0
- data/tools/pychecker/KNOWN_BUGS +0 -100
- data/tools/pychecker/MAINTAINERS +0 -81
- data/tools/pychecker/NEWS +0 -406
- data/tools/pychecker/OP.py +0 -131
- data/tools/pychecker/OP.pyc +0 -0
- data/tools/pychecker/OP.pyo +0 -0
- data/tools/pychecker/OptionTypes.py +0 -117
- data/tools/pychecker/OptionTypes.pyc +0 -0
- data/tools/pychecker/OptionTypes.pyo +0 -0
- data/tools/pychecker/README +0 -152
- data/tools/pychecker/Stack.py +0 -115
- data/tools/pychecker/Stack.pyc +0 -0
- data/tools/pychecker/Stack.pyo +0 -0
- data/tools/pychecker/TODO +0 -101
- data/tools/pychecker/VERSION +0 -1
- data/tools/pychecker/Warning.py +0 -50
- data/tools/pychecker/Warning.pyc +0 -0
- data/tools/pychecker/Warning.pyo +0 -0
- data/tools/pychecker/__init__.py +0 -17
- data/tools/pychecker/__init__.pyc +0 -0
- data/tools/pychecker/__init__.pyo +0 -0
- data/tools/pychecker/checker.py +0 -961
- data/tools/pychecker/checker.pyc +0 -0
- data/tools/pychecker/checker.pyo +0 -0
- data/tools/pychecker/function.py +0 -159
- data/tools/pychecker/function.pyc +0 -0
- data/tools/pychecker/function.pyo +0 -0
- data/tools/pychecker/msgs.py +0 -175
- data/tools/pychecker/msgs.pyc +0 -0
- data/tools/pychecker/msgs.pyo +0 -0
- data/tools/pychecker/options.py +0 -275
- data/tools/pychecker/options.pyc +0 -0
- data/tools/pychecker/options.pyo +0 -0
- data/tools/pychecker/pcmodules.py +0 -19
- data/tools/pychecker/pcmodules.pyc +0 -0
- data/tools/pychecker/pcmodules.pyo +0 -0
- data/tools/pychecker/printer.py +0 -47
- data/tools/pychecker/printer.pyc +0 -0
- data/tools/pychecker/printer.pyo +0 -0
- data/tools/pychecker/python.py +0 -427
- data/tools/pychecker/python.pyc +0 -0
- data/tools/pychecker/python.pyo +0 -0
- data/tools/pychecker/utils.py +0 -102
- data/tools/pychecker/utils.pyc +0 -0
- data/tools/pychecker/utils.pyo +0 -0
- data/tools/pychecker/warn.py +0 -778
- data/tools/pychecker/warn.pyc +0 -0
- data/tools/pychecker/warn.pyo +0 -0
- data/tools/pylint2/pylint/__init__.py +0 -16
- data/tools/pylint2/pylint/__pkginfo__.py +0 -67
- data/tools/pylint2/pylint/checkers/__init__.py +0 -155
- data/tools/pylint2/pylint/checkers/base.py +0 -749
- data/tools/pylint2/pylint/checkers/classes.py +0 -527
- data/tools/pylint2/pylint/checkers/design_analysis.py +0 -344
- data/tools/pylint2/pylint/checkers/exceptions.py +0 -183
- data/tools/pylint2/pylint/checkers/format.py +0 -367
- data/tools/pylint2/pylint/checkers/imports.py +0 -379
- data/tools/pylint2/pylint/checkers/logging.py +0 -98
- data/tools/pylint2/pylint/checkers/misc.py +0 -128
- data/tools/pylint2/pylint/checkers/newstyle.py +0 -107
- data/tools/pylint2/pylint/checkers/raw_metrics.py +0 -125
- data/tools/pylint2/pylint/checkers/similar.py +0 -333
- data/tools/pylint2/pylint/checkers/string_format.py +0 -239
- data/tools/pylint2/pylint/checkers/typecheck.py +0 -364
- data/tools/pylint2/pylint/checkers/utils.py +0 -208
- data/tools/pylint2/pylint/checkers/variables.py +0 -498
- data/tools/pylint2/pylint/config.py +0 -149
- data/tools/pylint2/pylint/epylint.py +0 -149
- data/tools/pylint2/pylint/gui.py +0 -433
- data/tools/pylint2/pylint/interfaces.py +0 -98
- data/tools/pylint2/pylint/lint.py +0 -914
- data/tools/pylint2/pylint/pyreverse/__init__.py +0 -5
- data/tools/pylint2/pylint/pyreverse/diadefslib.py +0 -229
- data/tools/pylint2/pylint/pyreverse/diagrams.py +0 -247
- data/tools/pylint2/pylint/pyreverse/main.py +0 -123
- data/tools/pylint2/pylint/pyreverse/utils.py +0 -131
- data/tools/pylint2/pylint/pyreverse/writer.py +0 -196
- data/tools/pylint2/pylint/reporters/__init__.py +0 -67
- data/tools/pylint2/pylint/reporters/guireporter.py +0 -36
- data/tools/pylint2/pylint/reporters/html.py +0 -69
- data/tools/pylint2/pylint/reporters/text.py +0 -156
- data/tools/pylint2/pylint/utils.py +0 -518
- data/tools/pylint2/pylint.py +0 -16
@@ -1,754 +0,0 @@
|
|
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
|
-
"""pytest is a tool that eases test running and debugging.
|
19
|
-
|
20
|
-
To be able to use pytest, you should either write tests using
|
21
|
-
the logilab.common.testlib's framework or the unittest module of the
|
22
|
-
Python's standard library.
|
23
|
-
|
24
|
-
You can customize pytest's behaviour by defining a ``pytestconf.py`` file
|
25
|
-
somewhere in your test directory. In this file, you can add options or
|
26
|
-
change the way tests are run.
|
27
|
-
|
28
|
-
To add command line options, you must define a ``update_parser`` function in
|
29
|
-
your ``pytestconf.py`` file. The function must accept a single parameter
|
30
|
-
that will be the OptionParser's instance to customize.
|
31
|
-
|
32
|
-
If you wish to customize the tester, you'll have to define a class named
|
33
|
-
``CustomPyTester``. This class should extend the default `PyTester` class
|
34
|
-
defined in the pytest module. Take a look at the `PyTester` and `DjangoTester`
|
35
|
-
classes for more information about what can be done.
|
36
|
-
|
37
|
-
For instance, if you wish to add a custom -l option to specify a loglevel, you
|
38
|
-
could define the following ``pytestconf.py`` file ::
|
39
|
-
|
40
|
-
import logging
|
41
|
-
from logilab.common.pytest import PyTester
|
42
|
-
|
43
|
-
def update_parser(parser):
|
44
|
-
parser.add_option('-l', '--loglevel', dest='loglevel', action='store',
|
45
|
-
choices=('debug', 'info', 'warning', 'error', 'critical'),
|
46
|
-
default='critical', help="the default log level possible choices are "
|
47
|
-
"('debug', 'info', 'warning', 'error', 'critical')")
|
48
|
-
return parser
|
49
|
-
|
50
|
-
|
51
|
-
class CustomPyTester(PyTester):
|
52
|
-
def __init__(self, cvg, options):
|
53
|
-
super(CustomPyTester, self).__init__(cvg, options)
|
54
|
-
loglevel = options.loglevel.upper()
|
55
|
-
logger = logging.getLogger('erudi')
|
56
|
-
logger.setLevel(logging.getLevelName(loglevel))
|
57
|
-
|
58
|
-
|
59
|
-
In your TestCase class you can then get the value of a specific option with
|
60
|
-
the ``optval`` method::
|
61
|
-
|
62
|
-
class MyTestCase(TestCase):
|
63
|
-
def test_foo(self):
|
64
|
-
loglevel = self.optval('loglevel')
|
65
|
-
# ...
|
66
|
-
|
67
|
-
|
68
|
-
You can also tag your tag your test for fine filtering
|
69
|
-
|
70
|
-
With those tag::
|
71
|
-
|
72
|
-
from logilab.common.testlib import tag, TestCase
|
73
|
-
|
74
|
-
class Exemple(TestCase):
|
75
|
-
|
76
|
-
@tag('rouge', 'carre')
|
77
|
-
def toto(self):
|
78
|
-
pass
|
79
|
-
|
80
|
-
@tag('carre', 'vert')
|
81
|
-
def tata(self):
|
82
|
-
pass
|
83
|
-
|
84
|
-
@tag('rouge')
|
85
|
-
def titi(test):
|
86
|
-
pass
|
87
|
-
|
88
|
-
you can filter the function with a simple python expression
|
89
|
-
|
90
|
-
* ``toto`` and ``titi`` match ``rouge``
|
91
|
-
|
92
|
-
* ``toto``, ``tata`` and ``titi``, match ``rouge or carre``
|
93
|
-
|
94
|
-
* ``tata`` and ``titi`` match``rouge ^ carre``
|
95
|
-
|
96
|
-
* ``titi`` match ``rouge and not carre``
|
97
|
-
"""
|
98
|
-
__docformat__ = "restructuredtext en"
|
99
|
-
|
100
|
-
PYTEST_DOC = """%prog [OPTIONS] [testfile [testpattern]]
|
101
|
-
|
102
|
-
examples:
|
103
|
-
|
104
|
-
pytest path/to/mytests.py
|
105
|
-
pytest path/to/mytests.py TheseTests
|
106
|
-
pytest path/to/mytests.py TheseTests.test_thisone
|
107
|
-
pytest path/to/mytests.py -m '(not long and database) or regr'
|
108
|
-
|
109
|
-
pytest one (will run both test_thisone and test_thatone)
|
110
|
-
pytest path/to/mytests.py -s not (will skip test_notthisone)
|
111
|
-
|
112
|
-
pytest --coverage test_foo.py
|
113
|
-
(only if logilab.devtools is available)
|
114
|
-
"""
|
115
|
-
|
116
|
-
import os, sys, re
|
117
|
-
import os.path as osp
|
118
|
-
from time import time, clock
|
119
|
-
import warnings
|
120
|
-
|
121
|
-
from logilab.common.fileutils import abspath_listdir
|
122
|
-
from logilab.common import testlib
|
123
|
-
import doctest
|
124
|
-
import unittest
|
125
|
-
|
126
|
-
|
127
|
-
import imp
|
128
|
-
|
129
|
-
import __builtin__
|
130
|
-
|
131
|
-
|
132
|
-
try:
|
133
|
-
import django
|
134
|
-
from logilab.common.modutils import modpath_from_file, load_module_from_modpath
|
135
|
-
DJANGO_FOUND = True
|
136
|
-
except ImportError:
|
137
|
-
DJANGO_FOUND = False
|
138
|
-
|
139
|
-
CONF_FILE = 'pytestconf.py'
|
140
|
-
|
141
|
-
## coverage hacks, do not read this, do not read this, do not read this
|
142
|
-
|
143
|
-
# hey, but this is an aspect, right ?!!!
|
144
|
-
class TraceController(object):
|
145
|
-
nesting = 0
|
146
|
-
|
147
|
-
def pause_tracing(cls):
|
148
|
-
if not cls.nesting:
|
149
|
-
cls.tracefunc = staticmethod(getattr(sys, '__settrace__', sys.settrace))
|
150
|
-
cls.oldtracer = getattr(sys, '__tracer__', None)
|
151
|
-
sys.__notrace__ = True
|
152
|
-
cls.tracefunc(None)
|
153
|
-
cls.nesting += 1
|
154
|
-
pause_tracing = classmethod(pause_tracing)
|
155
|
-
|
156
|
-
def resume_tracing(cls):
|
157
|
-
cls.nesting -= 1
|
158
|
-
assert cls.nesting >= 0
|
159
|
-
if not cls.nesting:
|
160
|
-
cls.tracefunc(cls.oldtracer)
|
161
|
-
delattr(sys, '__notrace__')
|
162
|
-
resume_tracing = classmethod(resume_tracing)
|
163
|
-
|
164
|
-
|
165
|
-
pause_tracing = TraceController.pause_tracing
|
166
|
-
resume_tracing = TraceController.resume_tracing
|
167
|
-
|
168
|
-
|
169
|
-
def nocoverage(func):
|
170
|
-
if hasattr(func, 'uncovered'):
|
171
|
-
return func
|
172
|
-
func.uncovered = True
|
173
|
-
def not_covered(*args, **kwargs):
|
174
|
-
pause_tracing()
|
175
|
-
try:
|
176
|
-
return func(*args, **kwargs)
|
177
|
-
finally:
|
178
|
-
resume_tracing()
|
179
|
-
not_covered.uncovered = True
|
180
|
-
return not_covered
|
181
|
-
|
182
|
-
|
183
|
-
## end of coverage hacks
|
184
|
-
|
185
|
-
|
186
|
-
# monkeypatch unittest and doctest (ouch !)
|
187
|
-
unittest.TestCase = testlib.TestCase
|
188
|
-
unittest.main = testlib.unittest_main
|
189
|
-
unittest._TextTestResult = testlib.SkipAwareTestResult
|
190
|
-
unittest.TextTestRunner = testlib.SkipAwareTextTestRunner
|
191
|
-
unittest.TestLoader = testlib.NonStrictTestLoader
|
192
|
-
unittest.TestProgram = testlib.SkipAwareTestProgram
|
193
|
-
if sys.version_info >= (2, 4):
|
194
|
-
doctest.DocTestCase.__bases__ = (testlib.TestCase,)
|
195
|
-
else:
|
196
|
-
unittest.FunctionTestCase.__bases__ = (testlib.TestCase,)
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
TESTFILE_RE = re.compile("^((unit)?test.*|smoketest)\.py$")
|
201
|
-
def this_is_a_testfile(filename):
|
202
|
-
"""returns True if `filename` seems to be a test file"""
|
203
|
-
return TESTFILE_RE.match(osp.basename(filename))
|
204
|
-
|
205
|
-
TESTDIR_RE = re.compile("^(unit)?tests?$")
|
206
|
-
def this_is_a_testdir(dirpath):
|
207
|
-
"""returns True if `filename` seems to be a test directory"""
|
208
|
-
return TESTDIR_RE.match(osp.basename(dirpath))
|
209
|
-
|
210
|
-
|
211
|
-
def load_pytest_conf(path, parser):
|
212
|
-
"""loads a ``pytestconf.py`` file and update default parser
|
213
|
-
and / or tester.
|
214
|
-
"""
|
215
|
-
namespace = {}
|
216
|
-
execfile(path, namespace)
|
217
|
-
if 'update_parser' in namespace:
|
218
|
-
namespace['update_parser'](parser)
|
219
|
-
return namespace.get('CustomPyTester', PyTester)
|
220
|
-
|
221
|
-
|
222
|
-
def project_root(parser, projdir=os.getcwd()):
|
223
|
-
"""try to find project's root and add it to sys.path"""
|
224
|
-
curdir = osp.abspath(projdir)
|
225
|
-
previousdir = curdir
|
226
|
-
testercls = PyTester
|
227
|
-
conf_file_path = osp.join(curdir, CONF_FILE)
|
228
|
-
if osp.isfile(conf_file_path):
|
229
|
-
testercls = load_pytest_conf(conf_file_path, parser)
|
230
|
-
while this_is_a_testdir(curdir) or \
|
231
|
-
osp.isfile(osp.join(curdir, '__init__.py')):
|
232
|
-
newdir = osp.normpath(osp.join(curdir, os.pardir))
|
233
|
-
if newdir == curdir:
|
234
|
-
break
|
235
|
-
previousdir = curdir
|
236
|
-
curdir = newdir
|
237
|
-
conf_file_path = osp.join(curdir, CONF_FILE)
|
238
|
-
if osp.isfile(conf_file_path):
|
239
|
-
testercls = load_pytest_conf(conf_file_path, parser)
|
240
|
-
return previousdir, testercls
|
241
|
-
|
242
|
-
|
243
|
-
class GlobalTestReport(object):
|
244
|
-
"""this class holds global test statistics"""
|
245
|
-
def __init__(self):
|
246
|
-
self.ran = 0
|
247
|
-
self.skipped = 0
|
248
|
-
self.failures = 0
|
249
|
-
self.errors = 0
|
250
|
-
self.ttime = 0
|
251
|
-
self.ctime = 0
|
252
|
-
self.modulescount = 0
|
253
|
-
self.errmodules = []
|
254
|
-
|
255
|
-
def feed(self, filename, testresult, ttime, ctime):
|
256
|
-
"""integrates new test information into internal statistics"""
|
257
|
-
ran = testresult.testsRun
|
258
|
-
self.ran += ran
|
259
|
-
self.skipped += len(getattr(testresult, 'skipped', ()))
|
260
|
-
self.failures += len(testresult.failures)
|
261
|
-
self.errors += len(testresult.errors)
|
262
|
-
self.ttime += ttime
|
263
|
-
self.ctime += ctime
|
264
|
-
self.modulescount += 1
|
265
|
-
if not testresult.wasSuccessful():
|
266
|
-
problems = len(testresult.failures) + len(testresult.errors)
|
267
|
-
self.errmodules.append((filename[:-3], problems, ran))
|
268
|
-
|
269
|
-
|
270
|
-
def failed_to_test_module(self, filename):
|
271
|
-
"""called when the test module could not be imported by unittest
|
272
|
-
"""
|
273
|
-
self.errors += 1
|
274
|
-
self.modulescount += 1
|
275
|
-
self.ran += 1
|
276
|
-
self.errmodules.append((filename[:-3], 1, 1))
|
277
|
-
|
278
|
-
def skip_module(self, filename):
|
279
|
-
self.modulescount += 1
|
280
|
-
self.ran += 1
|
281
|
-
self.errmodules.append((filename[:-3], 0, 0))
|
282
|
-
|
283
|
-
def __str__(self):
|
284
|
-
"""this is just presentation stuff"""
|
285
|
-
line1 = ['Ran %s test cases in %.2fs (%.2fs CPU)'
|
286
|
-
% (self.ran, self.ttime, self.ctime)]
|
287
|
-
if self.errors:
|
288
|
-
line1.append('%s errors' % self.errors)
|
289
|
-
if self.failures:
|
290
|
-
line1.append('%s failures' % self.failures)
|
291
|
-
if self.skipped:
|
292
|
-
line1.append('%s skipped' % self.skipped)
|
293
|
-
modulesok = self.modulescount - len(self.errmodules)
|
294
|
-
if self.errors or self.failures:
|
295
|
-
line2 = '%s modules OK (%s failed)' % (modulesok,
|
296
|
-
len(self.errmodules))
|
297
|
-
descr = ', '.join(['%s [%s/%s]' % info for info in self.errmodules])
|
298
|
-
line3 = '\nfailures: %s' % descr
|
299
|
-
elif modulesok:
|
300
|
-
line2 = 'All %s modules OK' % modulesok
|
301
|
-
line3 = ''
|
302
|
-
else:
|
303
|
-
return ''
|
304
|
-
return '%s\n%s%s' % (', '.join(line1), line2, line3)
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
def remove_local_modules_from_sys(testdir):
|
309
|
-
"""remove all modules from cache that come from `testdir`
|
310
|
-
|
311
|
-
This is used to avoid strange side-effects when using the
|
312
|
-
testall() mode of pytest.
|
313
|
-
For instance, if we run pytest on this tree::
|
314
|
-
|
315
|
-
A/test/test_utils.py
|
316
|
-
B/test/test_utils.py
|
317
|
-
|
318
|
-
we **have** to clean sys.modules to make sure the correct test_utils
|
319
|
-
module is ran in B
|
320
|
-
"""
|
321
|
-
for modname, mod in sys.modules.items():
|
322
|
-
if mod is None:
|
323
|
-
continue
|
324
|
-
if not hasattr(mod, '__file__'):
|
325
|
-
# this is the case of some built-in modules like sys, imp, marshal
|
326
|
-
continue
|
327
|
-
modfile = mod.__file__
|
328
|
-
# if modfile is not an absolute path, it was probably loaded locally
|
329
|
-
# during the tests
|
330
|
-
if not osp.isabs(modfile) or modfile.startswith(testdir):
|
331
|
-
del sys.modules[modname]
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
class PyTester(object):
|
336
|
-
"""encapsulates testrun logic"""
|
337
|
-
|
338
|
-
def __init__(self, cvg, options):
|
339
|
-
self.report = GlobalTestReport()
|
340
|
-
self.cvg = cvg
|
341
|
-
self.options = options
|
342
|
-
self.firstwrite = True
|
343
|
-
self._errcode = None
|
344
|
-
|
345
|
-
def show_report(self):
|
346
|
-
"""prints the report and returns appropriate exitcode"""
|
347
|
-
# everything has been ran, print report
|
348
|
-
print "*" * 79
|
349
|
-
print self.report
|
350
|
-
|
351
|
-
def get_errcode(self):
|
352
|
-
# errcode set explicitly
|
353
|
-
if self._errcode is not None:
|
354
|
-
return self._errcode
|
355
|
-
return self.report.failures + self.report.errors
|
356
|
-
|
357
|
-
def set_errcode(self, errcode):
|
358
|
-
self._errcode = errcode
|
359
|
-
errcode = property(get_errcode, set_errcode)
|
360
|
-
|
361
|
-
def testall(self, exitfirst=False):
|
362
|
-
"""walks through current working directory, finds something
|
363
|
-
which can be considered as a testdir and runs every test there
|
364
|
-
"""
|
365
|
-
here = os.getcwd()
|
366
|
-
for dirname, dirs, _ in os.walk(here):
|
367
|
-
for skipped in ('CVS', '.svn', '.hg'):
|
368
|
-
if skipped in dirs:
|
369
|
-
dirs.remove(skipped)
|
370
|
-
basename = osp.basename(dirname)
|
371
|
-
if this_is_a_testdir(basename):
|
372
|
-
print "going into", dirname
|
373
|
-
# we found a testdir, let's explore it !
|
374
|
-
if not self.testonedir(dirname, exitfirst):
|
375
|
-
break
|
376
|
-
dirs[:] = []
|
377
|
-
if self.report.ran == 0:
|
378
|
-
print "no test dir found testing here:", here
|
379
|
-
# if no test was found during the visit, consider
|
380
|
-
# the local directory as a test directory even if
|
381
|
-
# it doesn't have a traditional test directory name
|
382
|
-
self.testonedir(here)
|
383
|
-
|
384
|
-
def testonedir(self, testdir, exitfirst=False):
|
385
|
-
"""finds each testfile in the `testdir` and runs it
|
386
|
-
|
387
|
-
return true when all tests has been executed, false if exitfirst and
|
388
|
-
some test has failed.
|
389
|
-
"""
|
390
|
-
for filename in abspath_listdir(testdir):
|
391
|
-
if this_is_a_testfile(filename):
|
392
|
-
if self.options.exitfirst and not self.options.restart:
|
393
|
-
# overwrite restart file
|
394
|
-
try:
|
395
|
-
restartfile = open(testlib.FILE_RESTART, "w")
|
396
|
-
restartfile.close()
|
397
|
-
except Exception, e:
|
398
|
-
print >> sys.__stderr__, "Error while overwriting \
|
399
|
-
succeeded test file :", osp.join(os.getcwd(),testlib.FILE_RESTART)
|
400
|
-
raise e
|
401
|
-
# run test and collect information
|
402
|
-
prog = self.testfile(filename, batchmode=True)
|
403
|
-
if exitfirst and (prog is None or not prog.result.wasSuccessful()):
|
404
|
-
return False
|
405
|
-
self.firstwrite = True
|
406
|
-
# clean local modules
|
407
|
-
remove_local_modules_from_sys(testdir)
|
408
|
-
return True
|
409
|
-
|
410
|
-
def testfile(self, filename, batchmode=False):
|
411
|
-
"""runs every test in `filename`
|
412
|
-
|
413
|
-
:param filename: an absolute path pointing to a unittest file
|
414
|
-
"""
|
415
|
-
here = os.getcwd()
|
416
|
-
dirname = osp.dirname(filename)
|
417
|
-
if dirname:
|
418
|
-
os.chdir(dirname)
|
419
|
-
# overwrite restart file if it has not been done already
|
420
|
-
if self.options.exitfirst and not self.options.restart and self.firstwrite:
|
421
|
-
try:
|
422
|
-
restartfile = open(testlib.FILE_RESTART, "w")
|
423
|
-
restartfile.close()
|
424
|
-
except Exception, e:
|
425
|
-
print >> sys.__stderr__, "Error while overwriting \
|
426
|
-
succeeded test file :", osp.join(os.getcwd(),testlib.FILE_RESTART)
|
427
|
-
raise e
|
428
|
-
modname = osp.basename(filename)[:-3]
|
429
|
-
try:
|
430
|
-
print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70, '=')
|
431
|
-
except TypeError: # < py 2.4 bw compat
|
432
|
-
print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70)
|
433
|
-
try:
|
434
|
-
tstart, cstart = time(), clock()
|
435
|
-
try:
|
436
|
-
testprog = testlib.unittest_main(modname, batchmode=batchmode, cvg=self.cvg,
|
437
|
-
options=self.options, outstream=sys.stderr)
|
438
|
-
except KeyboardInterrupt:
|
439
|
-
raise
|
440
|
-
except SystemExit, exc:
|
441
|
-
self.errcode = exc.code
|
442
|
-
raise
|
443
|
-
except testlib.TestSkipped:
|
444
|
-
print "Module skipped:", filename
|
445
|
-
self.report.skip_module(filename)
|
446
|
-
return None
|
447
|
-
except Exception:
|
448
|
-
self.report.failed_to_test_module(filename)
|
449
|
-
print >> sys.stderr, 'unhandled exception occurred while testing', modname
|
450
|
-
import traceback
|
451
|
-
traceback.print_exc(file=sys.stderr)
|
452
|
-
return None
|
453
|
-
|
454
|
-
tend, cend = time(), clock()
|
455
|
-
ttime, ctime = (tend - tstart), (cend - cstart)
|
456
|
-
self.report.feed(filename, testprog.result, ttime, ctime)
|
457
|
-
return testprog
|
458
|
-
finally:
|
459
|
-
if dirname:
|
460
|
-
os.chdir(here)
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
class DjangoTester(PyTester):
|
465
|
-
|
466
|
-
def load_django_settings(self, dirname):
|
467
|
-
"""try to find project's setting and load it"""
|
468
|
-
curdir = osp.abspath(dirname)
|
469
|
-
previousdir = curdir
|
470
|
-
while not osp.isfile(osp.join(curdir, 'settings.py')) and \
|
471
|
-
osp.isfile(osp.join(curdir, '__init__.py')):
|
472
|
-
newdir = osp.normpath(osp.join(curdir, os.pardir))
|
473
|
-
if newdir == curdir:
|
474
|
-
raise AssertionError('could not find settings.py')
|
475
|
-
previousdir = curdir
|
476
|
-
curdir = newdir
|
477
|
-
# late django initialization
|
478
|
-
settings = load_module_from_modpath(modpath_from_file(osp.join(curdir, 'settings.py')))
|
479
|
-
from django.core.management import setup_environ
|
480
|
-
setup_environ(settings)
|
481
|
-
settings.DEBUG = False
|
482
|
-
self.settings = settings
|
483
|
-
# add settings dir to pythonpath since it's the project's root
|
484
|
-
if curdir not in sys.path:
|
485
|
-
sys.path.insert(1, curdir)
|
486
|
-
|
487
|
-
def before_testfile(self):
|
488
|
-
# Those imports must be done **after** setup_environ was called
|
489
|
-
from django.test.utils import setup_test_environment
|
490
|
-
from django.test.utils import create_test_db
|
491
|
-
setup_test_environment()
|
492
|
-
create_test_db(verbosity=0)
|
493
|
-
self.dbname = self.settings.TEST_DATABASE_NAME
|
494
|
-
|
495
|
-
|
496
|
-
def after_testfile(self):
|
497
|
-
# Those imports must be done **after** setup_environ was called
|
498
|
-
from django.test.utils import teardown_test_environment
|
499
|
-
from django.test.utils import destroy_test_db
|
500
|
-
teardown_test_environment()
|
501
|
-
print 'destroying', self.dbname
|
502
|
-
destroy_test_db(self.dbname, verbosity=0)
|
503
|
-
|
504
|
-
|
505
|
-
def testall(self, exitfirst=False):
|
506
|
-
"""walks through current working directory, finds something
|
507
|
-
which can be considered as a testdir and runs every test there
|
508
|
-
"""
|
509
|
-
for dirname, dirs, _ in os.walk(os.getcwd()):
|
510
|
-
for skipped in ('CVS', '.svn', '.hg'):
|
511
|
-
if skipped in dirs:
|
512
|
-
dirs.remove(skipped)
|
513
|
-
if 'tests.py' in files:
|
514
|
-
if not self.testonedir(dirname, exitfirst):
|
515
|
-
break
|
516
|
-
dirs[:] = []
|
517
|
-
else:
|
518
|
-
basename = osp.basename(dirname)
|
519
|
-
if basename in ('test', 'tests'):
|
520
|
-
print "going into", dirname
|
521
|
-
# we found a testdir, let's explore it !
|
522
|
-
if not self.testonedir(dirname, exitfirst):
|
523
|
-
break
|
524
|
-
dirs[:] = []
|
525
|
-
|
526
|
-
|
527
|
-
def testonedir(self, testdir, exitfirst=False):
|
528
|
-
"""finds each testfile in the `testdir` and runs it
|
529
|
-
|
530
|
-
return true when all tests has been executed, false if exitfirst and
|
531
|
-
some test has failed.
|
532
|
-
"""
|
533
|
-
# special django behaviour : if tests are splitted in several files,
|
534
|
-
# remove the main tests.py file and tests each test file separately
|
535
|
-
testfiles = [fpath for fpath in abspath_listdir(testdir)
|
536
|
-
if this_is_a_testfile(fpath)]
|
537
|
-
if len(testfiles) > 1:
|
538
|
-
try:
|
539
|
-
testfiles.remove(osp.join(testdir, 'tests.py'))
|
540
|
-
except ValueError:
|
541
|
-
pass
|
542
|
-
for filename in testfiles:
|
543
|
-
# run test and collect information
|
544
|
-
prog = self.testfile(filename, batchmode=True)
|
545
|
-
if exitfirst and (prog is None or not prog.result.wasSuccessful()):
|
546
|
-
return False
|
547
|
-
# clean local modules
|
548
|
-
remove_local_modules_from_sys(testdir)
|
549
|
-
return True
|
550
|
-
|
551
|
-
|
552
|
-
def testfile(self, filename, batchmode=False):
|
553
|
-
"""runs every test in `filename`
|
554
|
-
|
555
|
-
:param filename: an absolute path pointing to a unittest file
|
556
|
-
"""
|
557
|
-
here = os.getcwd()
|
558
|
-
dirname = osp.dirname(filename)
|
559
|
-
if dirname:
|
560
|
-
os.chdir(dirname)
|
561
|
-
self.load_django_settings(dirname)
|
562
|
-
modname = osp.basename(filename)[:-3]
|
563
|
-
print >>sys.stderr, (' %s ' % osp.basename(filename)).center(70, '=')
|
564
|
-
try:
|
565
|
-
try:
|
566
|
-
tstart, cstart = time(), clock()
|
567
|
-
self.before_testfile()
|
568
|
-
testprog = testlib.unittest_main(modname, batchmode=batchmode, cvg=self.cvg)
|
569
|
-
tend, cend = time(), clock()
|
570
|
-
ttime, ctime = (tend - tstart), (cend - cstart)
|
571
|
-
self.report.feed(filename, testprog.result, ttime, ctime)
|
572
|
-
return testprog
|
573
|
-
except SystemExit:
|
574
|
-
raise
|
575
|
-
except Exception, exc:
|
576
|
-
import traceback
|
577
|
-
traceback.print_exc()
|
578
|
-
self.report.failed_to_test_module(filename)
|
579
|
-
print 'unhandled exception occurred while testing', modname
|
580
|
-
print 'error: %s' % exc
|
581
|
-
return None
|
582
|
-
finally:
|
583
|
-
self.after_testfile()
|
584
|
-
if dirname:
|
585
|
-
os.chdir(here)
|
586
|
-
|
587
|
-
|
588
|
-
def make_parser():
|
589
|
-
"""creates the OptionParser instance
|
590
|
-
"""
|
591
|
-
from optparse import OptionParser
|
592
|
-
parser = OptionParser(usage=PYTEST_DOC)
|
593
|
-
|
594
|
-
parser.newargs = []
|
595
|
-
def rebuild_cmdline(option, opt, value, parser):
|
596
|
-
"""carry the option to unittest_main"""
|
597
|
-
parser.newargs.append(opt)
|
598
|
-
|
599
|
-
def rebuild_and_store(option, opt, value, parser):
|
600
|
-
"""carry the option to unittest_main and store
|
601
|
-
the value on current parser
|
602
|
-
"""
|
603
|
-
parser.newargs.append(opt)
|
604
|
-
setattr(parser.values, option.dest, True)
|
605
|
-
|
606
|
-
def capture_and_rebuild(option, opt, value, parser):
|
607
|
-
warnings.simplefilter('ignore', DeprecationWarning)
|
608
|
-
rebuild_cmdline(option, opt, value, parser)
|
609
|
-
|
610
|
-
# pytest options
|
611
|
-
parser.add_option('-t', dest='testdir', default=None,
|
612
|
-
help="directory where the tests will be found")
|
613
|
-
parser.add_option('-d', dest='dbc', default=False,
|
614
|
-
action="store_true", help="enable design-by-contract")
|
615
|
-
# unittest_main options provided and passed through pytest
|
616
|
-
parser.add_option('-v', '--verbose', callback=rebuild_cmdline,
|
617
|
-
action="callback", help="Verbose output")
|
618
|
-
parser.add_option('-i', '--pdb', callback=rebuild_and_store,
|
619
|
-
dest="pdb", action="callback",
|
620
|
-
help="Enable test failure inspection (conflicts with --coverage)")
|
621
|
-
parser.add_option('-x', '--exitfirst', callback=rebuild_and_store,
|
622
|
-
dest="exitfirst", default=False,
|
623
|
-
action="callback", help="Exit on first failure "
|
624
|
-
"(only make sense when pytest run one test file)")
|
625
|
-
parser.add_option('-R', '--restart', callback=rebuild_and_store,
|
626
|
-
dest="restart", default=False,
|
627
|
-
action="callback",
|
628
|
-
help="Restart tests from where it failed (implies exitfirst) "
|
629
|
-
"(only make sense if tests previously ran with exitfirst only)")
|
630
|
-
parser.add_option('-c', '--capture', callback=capture_and_rebuild,
|
631
|
-
action="callback",
|
632
|
-
help="Captures and prints standard out/err only on errors "
|
633
|
-
"(only make sense when pytest run one test file)")
|
634
|
-
parser.add_option('--color', callback=rebuild_cmdline,
|
635
|
-
action="callback",
|
636
|
-
help="colorize tracebacks")
|
637
|
-
parser.add_option('-p', '--printonly',
|
638
|
-
# XXX: I wish I could use the callback action but it
|
639
|
-
# doesn't seem to be able to get the value
|
640
|
-
# associated to the option
|
641
|
-
action="store", dest="printonly", default=None,
|
642
|
-
help="Only prints lines matching specified pattern (implies capture) "
|
643
|
-
"(only make sense when pytest run one test file)")
|
644
|
-
parser.add_option('-s', '--skip',
|
645
|
-
# XXX: I wish I could use the callback action but it
|
646
|
-
# doesn't seem to be able to get the value
|
647
|
-
# associated to the option
|
648
|
-
action="store", dest="skipped", default=None,
|
649
|
-
help="test names matching this name will be skipped "
|
650
|
-
"to skip several patterns, use commas")
|
651
|
-
parser.add_option('-q', '--quiet', callback=rebuild_cmdline,
|
652
|
-
action="callback", help="Minimal output")
|
653
|
-
parser.add_option('-P', '--profile', default=None, dest='profile',
|
654
|
-
help="Profile execution and store data in the given file")
|
655
|
-
parser.add_option('-m', '--match', default=None, dest='tags_pattern',
|
656
|
-
help="only execute test whose tag match the current pattern")
|
657
|
-
|
658
|
-
try:
|
659
|
-
from logilab.devtools.lib.coverage import Coverage
|
660
|
-
parser.add_option('--coverage', dest="coverage", default=False,
|
661
|
-
action="store_true",
|
662
|
-
help="run tests with pycoverage (conflicts with --pdb)")
|
663
|
-
except ImportError:
|
664
|
-
pass
|
665
|
-
|
666
|
-
if DJANGO_FOUND:
|
667
|
-
parser.add_option('-J', '--django', dest='django', default=False,
|
668
|
-
action="store_true",
|
669
|
-
help='use pytest for django test cases')
|
670
|
-
return parser
|
671
|
-
|
672
|
-
|
673
|
-
def parseargs(parser):
|
674
|
-
"""Parse the command line and return (options processed), (options to pass to
|
675
|
-
unittest_main()), (explicitfile or None).
|
676
|
-
"""
|
677
|
-
# parse the command line
|
678
|
-
options, args = parser.parse_args()
|
679
|
-
if options.pdb and getattr(options, 'coverage', False):
|
680
|
-
parser.error("'pdb' and 'coverage' options are exclusive")
|
681
|
-
filenames = [arg for arg in args if arg.endswith('.py')]
|
682
|
-
if filenames:
|
683
|
-
if len(filenames) > 1:
|
684
|
-
parser.error("only one filename is acceptable")
|
685
|
-
explicitfile = filenames[0]
|
686
|
-
args.remove(explicitfile)
|
687
|
-
else:
|
688
|
-
explicitfile = None
|
689
|
-
# someone wants DBC
|
690
|
-
testlib.ENABLE_DBC = options.dbc
|
691
|
-
newargs = parser.newargs
|
692
|
-
if options.printonly:
|
693
|
-
newargs.extend(['--printonly', options.printonly])
|
694
|
-
if options.skipped:
|
695
|
-
newargs.extend(['--skip', options.skipped])
|
696
|
-
# restart implies exitfirst
|
697
|
-
if options.restart:
|
698
|
-
options.exitfirst = True
|
699
|
-
# append additional args to the new sys.argv and let unittest_main
|
700
|
-
# do the rest
|
701
|
-
newargs += args
|
702
|
-
return options, explicitfile
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
def run():
|
707
|
-
parser = make_parser()
|
708
|
-
rootdir, testercls = project_root(parser)
|
709
|
-
options, explicitfile = parseargs(parser)
|
710
|
-
# mock a new command line
|
711
|
-
sys.argv[1:] = parser.newargs
|
712
|
-
covermode = getattr(options, 'coverage', None)
|
713
|
-
cvg = None
|
714
|
-
if not '' in sys.path:
|
715
|
-
sys.path.insert(0, '')
|
716
|
-
if covermode:
|
717
|
-
# control_import_coverage(rootdir)
|
718
|
-
from logilab.devtools.lib.coverage import Coverage
|
719
|
-
cvg = Coverage([rootdir])
|
720
|
-
cvg.erase()
|
721
|
-
cvg.start()
|
722
|
-
if DJANGO_FOUND and options.django:
|
723
|
-
tester = DjangoTester(cvg, options)
|
724
|
-
else:
|
725
|
-
tester = testercls(cvg, options)
|
726
|
-
if explicitfile:
|
727
|
-
cmd, args = tester.testfile, (explicitfile,)
|
728
|
-
elif options.testdir:
|
729
|
-
cmd, args = tester.testonedir, (options.testdir, options.exitfirst)
|
730
|
-
else:
|
731
|
-
cmd, args = tester.testall, (options.exitfirst,)
|
732
|
-
try:
|
733
|
-
try:
|
734
|
-
if options.profile:
|
735
|
-
import hotshot
|
736
|
-
prof = hotshot.Profile(options.profile)
|
737
|
-
prof.runcall(cmd, *args)
|
738
|
-
prof.close()
|
739
|
-
print 'profile data saved in', options.profile
|
740
|
-
else:
|
741
|
-
cmd(*args)
|
742
|
-
except SystemExit:
|
743
|
-
raise
|
744
|
-
except:
|
745
|
-
import traceback
|
746
|
-
traceback.print_exc()
|
747
|
-
finally:
|
748
|
-
if covermode:
|
749
|
-
cvg.stop()
|
750
|
-
cvg.save()
|
751
|
-
tester.show_report()
|
752
|
-
if covermode:
|
753
|
-
print 'coverage information stored, use it with pycoverage -ra'
|
754
|
-
sys.exit(tester.errcode)
|