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,956 +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
|
-
"""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()
|