⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sb_test_support.py

📁 用python实现的邮件过滤器
💻 PY
字号:
# General utilities for the SpamBayes test suite##import sys, osimport unittestdef fix_sys_path():    # XXX - MarkH had the bright idea *after* writing this that we should    # ensure the CVS version of SpamBayes is *not* used to resolve SB imports.    # This would allow us to effectively test the distutils setup script, so    # any modules or files missing from the installed version raise errors.    """Fix sys.path so that the core SpamBayes package,    *and* the SpamBayes scripts can be imported.    """    this_dir = os.path.dirname(__file__)    try:        import spambayes.Version    except ImportError:        # Apparently SpamBayes is yet to be "setup.py install"        # We are in 'spambayes\spambayes\test' - 2 parents up should        # do it.        sb_dir = os.path.abspath(                     os.path.join(this_dir, "..", ".."))        sys.path.insert(0, sb_dir)        import spambayes.Version    # Now do the same for the sb_* scripts    try:        import sb_server    except ImportError:        # Scripts are usually in "spambayes/scripts" (for an        # installed SpamBayes, they appear to be in        # os.path.join(sys.prefix(), "scripts"), which we may like to        # leverage - however, these test scripts are not currently        # installed).        script_dir = os.path.abspath(                     os.path.join(this_dir, "..", "..", "scripts"))        sys.path.insert(0, script_dir)        import sb_server# Entry point for all our 'simple' based test programsdef unittest_main(*args, **kwargs):    # I bet one day this will be more than this <wink>    unittest.main(*args, **kwargs)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -