root/galaxy-central/eggs/twill-0.9-py2.6.egg/twill/__init__.py

リビジョン 3, 2.4 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1# This file is part of the twill source distribution.
2#
3# twill is a extensible scriptlet language for testing Web apps,
4# available at http://twill.idyll.org/.
5#
6# Contact author: C. Titus Brown, titus@idyll.org.
7#
8# This program and all associated source code files are Copyright (C)
9# 2005-2007 by C. Titus Brown.  It is released under the MIT license;
10# please see the included LICENSE.txt file for more information, or
11# go to http://www.opensource.org/licenses/mit-license.php.
12
13"""
14twill Web testing language & associated utilities.
15"""
16
17__version__ = "0.9"
18
19#import warnings
20#warnings.defaultaction = "error"
21
22#import pychecker.checker
23
24__all__ = [ "TwillCommandLoop",
25            "execute_file",
26            "execute_string",
27            "get_browser",
28            "add_wsgi_intercept",
29            "remove_wsgi_intercept",
30            "set_output",
31            "set_errout"]
32
33#
34# add extensions (twill/extensions) and the the wwwsearch & pyparsing
35# stuff from twill/included-packages/.  NOTE: this works with eggs! hooray!
36#
37
38import sys, os.path
39thisdir = os.path.dirname(__file__)
40
41# add extensions directory at the *end* of sys.path.  This means that
42# user extensions will take priority over twill extensions.
43extensions = os.path.join(thisdir, 'extensions')
44sys.path.append(extensions)
45
46# add other_packages in at the *beginning*, so that the correct
47# (patched) versions of pyparsing and mechanize get imported.
48wwwsearchlib = os.path.join(thisdir, 'other_packages')
49sys.path.insert(0, wwwsearchlib)
50
51# the two core components of twill:
52from shell import TwillCommandLoop
53from parse import execute_file, execute_string
54
55# convenience function or two...
56from commands import get_browser
57
58def get_browser_state():
59    import warnings
60    warnings.warn("""\
61get_browser_state is deprecated; use 'twill.get_browser() instead.
62""", DeprecationWarning)
63    return get_browser()
64
65# initialize global dict
66import namespaces
67namespaces.init_global_dict()
68
69from wsgi_intercept import add_wsgi_intercept, remove_wsgi_intercept
70
71def set_output(fp):
72    """
73    Have standard output from twill go to the given fp instead of
74    stdout.  fp=None will reset to stdout.
75    """
76    import commands, browser
77    commands.OUT = browser.OUT = fp
78
79def set_errout(fp):
80    """
81    Have error output from twill go to the given fp instead of stderr.
82    fp=None will reset to stderr.
83    """
84    import commands
85    if fp:
86        commands.ERR = fp
87    else:
88        commands.ERR = sys.stderr
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。