-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e8d41c6
Showing
79 changed files
with
32,336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Created by https://www.gitignore.io | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Metadata-Version: 1.0 | ||
Name: twill | ||
Version: 1.8.0 | ||
Summary: twill Web browsing language | ||
Home-page: http://twill.idyll.org/ | ||
Author: C. Titus Brown | ||
Author-email: [email protected] | ||
License: MIT | ||
Description: A scripting system for automating Web browsing. Useful for testing | ||
Web pages or grabbing data from password-protected sites automatically. | ||
|
||
Platform: UNKNOWN | ||
Classifier: Development Status :: 4 - Beta | ||
Classifier: Environment :: Console | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Intended Audience :: System Administrators | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Natural Language :: English | ||
Classifier: Operating System :: OS Independent | ||
Classifier: Programming Language :: Python | ||
Classifier: Programming Language :: Other Scripting Engines | ||
Classifier: Topic :: Internet :: WWW/HTTP | ||
Classifier: Topic :: Software Development :: Testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
twill: a simple scripting language for Web browsing | ||
=================================================== | ||
|
||
twill is a simple scripting language intended for programmatic or | ||
automated browsing of Web sites. | ||
|
||
Documentation is available in the release package under | ||
doc/index.txt or doc/index.html. | ||
|
||
The latest release as well as all documentation is always online at | ||
http://twill.idyll.org/. You can also find | ||
information on mailing lists, bug fixes, and new releases there. | ||
|
||
twill is Copyright (C) 2005, 2006, 2007 by C. Titus Brown, and is | ||
available for use, modification, and distribution under the MIT | ||
license. | ||
|
||
Contact [email protected] with questions or comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[egg_info] | ||
tag_build = | ||
tag_date = 0 | ||
tag_svn_revision = 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env python | ||
|
||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
print('(WARNING: importing distutils, not setuptools!)') | ||
from distutils.core import setup | ||
|
||
#### twill info. | ||
|
||
setup(name = 'twill', | ||
|
||
version = '1.8.0', | ||
# download_url = 'http://darcs.idyll.org/~t/projects/twill-0.9.tar.gz', | ||
|
||
description = 'twill Web browsing language', | ||
author = 'C. Titus Brown and Ben R. Taylor', | ||
author_email = '[email protected]', | ||
license='MIT', | ||
|
||
packages = ['twill', 'twill.other_packages', | ||
'twill.other_packages._mechanize_dist', | ||
'twill.extensions', | ||
'twill.extensions.match_parse'], | ||
|
||
# allow both | ||
entry_points = dict(console_scripts=['twill-sh = twill.shell:main'],), | ||
scripts = ['twill-fork'], | ||
|
||
maintainer = 'C. Titus Brown', | ||
maintainer_email = '[email protected]', | ||
|
||
url = 'http://twill.idyll.org/', | ||
long_description = """\ | ||
A scripting system for automating Web browsing. Useful for testing | ||
Web pages or grabbing data from password-protected sites automatically. | ||
""", | ||
classifiers = ['Development Status :: 4 - Beta', | ||
'Environment :: Console', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: System Administrators', | ||
'License :: OSI Approved :: MIT License', | ||
'Natural Language :: English', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Other Scripting Engines', | ||
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Software Development :: Testing', | ||
], | ||
|
||
test_suite = 'nose.collector' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
#! /usr/bin/env python | ||
# This file is part of the twill source distribution. | ||
# | ||
# twill is a extensible scriptlet language for testing Web apps, | ||
# available at http://twill.idyll.org/. | ||
# | ||
# Contact author: C. Titus Brown, [email protected]. | ||
# | ||
# This program and all associated source code files are Copyright (C) | ||
# 2005-2007 by C. Titus Brown. It is released under the MIT license; | ||
# please see the included LICENSE.txt file for more information, or | ||
# go to http://www.opensource.org/licenses/mit-license.php. | ||
|
||
""" | ||
twill multiprocess execution system. | ||
""" | ||
|
||
import sys, os, time | ||
from twill import execute_file | ||
from optparse import OptionParser | ||
from cPickle import load, dump | ||
|
||
### | ||
# make sure that the current working directory is in the path. does this | ||
# work on Windows?? | ||
|
||
if not '.' in sys.path: | ||
sys.path.append('.') | ||
### | ||
|
||
#### OPTIONS | ||
|
||
parser = OptionParser() | ||
|
||
parser.add_option('-u', '--url', nargs=1, action="store", dest="url", | ||
help="start at the given URL before each script") | ||
|
||
parser.add_option('-n', '--number', nargs=1, action="store", dest="number", | ||
default=1, type="int", | ||
help="number of times to run the given script(s)") | ||
|
||
parser.add_option('-p', '--processes', nargs=1, action="store", | ||
dest="processes", default=1, type="int", | ||
help="number of processes to execute in parallel") | ||
|
||
#### | ||
|
||
# parse arguments. | ||
(options, args) = parser.parse_args() | ||
|
||
if not len(args): | ||
sys.stderr.write('Error! Must specify one or more scripts to execute...\n') | ||
sys.exit(-1) | ||
|
||
average_number = int(options.number / options.processes) | ||
last_number = average_number + options.number % options.processes | ||
is_parent = True | ||
child_pids = [] | ||
|
||
# | ||
# start a bunch of child processes & record their pids in the parent. | ||
# | ||
|
||
for i in range(0, options.processes): | ||
pid = os.fork() | ||
if pid == 0: | ||
if i == 0: | ||
repeat = last_number # make sure we execute 'em *all* | ||
else: | ||
repeat = average_number | ||
|
||
is_parent = False | ||
break | ||
else: | ||
child_pids.append(pid) # keep track of children | ||
|
||
# | ||
# set the children up to run & record their stats | ||
# | ||
|
||
failed = False | ||
|
||
if not is_parent: | ||
print '[twill-fork: pid %d : executing %d times]' % (os.getpid(), repeat) | ||
|
||
start_time = time.time() | ||
|
||
for i in range(0, repeat): | ||
for filename in args: | ||
execute_file(filename, initial_url=options.url) | ||
|
||
end_time = time.time() | ||
this_time = end_time - start_time | ||
|
||
# write statistics | ||
fp = open('.status.%d' % (os.getpid(),), 'w') | ||
info = (this_time, repeat) | ||
dump(info, fp) | ||
fp.close() | ||
|
||
else: # is_parent | ||
total_time = 0. | ||
total_exec = 0 | ||
|
||
# iterate over all the child pids, wait 'til they finish, and then | ||
# sum statistics. | ||
|
||
left_childs = child_pids[:] | ||
for child_pid in left_childs: | ||
child_pid, status = os.waitpid(child_pid, 0) | ||
|
||
# status != 0 indicates failure: | ||
|
||
if status != 0: | ||
print '[twill-fork parent: process %d FAILED: exit status %d]' % (child_pid, status,) | ||
print '[twill-fork parent: (not counting stats for this process)]' | ||
failed = True | ||
else: | ||
# record statistics, otherwise | ||
|
||
fp = open('.status.%d' % (child_pid,)) | ||
(this_time, n_executed) = load(fp) | ||
fp.close() | ||
os.unlink('.status.%d' % (child_pid,)) | ||
|
||
total_time += this_time | ||
total_exec += n_executed | ||
|
||
# | ||
# summarize | ||
# | ||
|
||
print '\n---' | ||
print 'n processes: %d' % (options.processes,) | ||
print 'total executed: %d' % (total_exec,) | ||
print 'total time to execute: %f' % (total_time,) | ||
if total_exec: | ||
print 'average time: %f' % (total_time / total_exec,) | ||
else: | ||
print '(nothing completed, no average!)' | ||
|
||
if failed: | ||
sys.exit(-1) | ||
|
||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# This file is part of the twill source distribution. | ||
# | ||
# twill is a extensible scriptlet language for testing Web apps, | ||
# available at http://twill.idyll.org/. | ||
# | ||
# Contact author: C. Titus Brown, [email protected]. | ||
# | ||
# This program and all associated source code files are Copyright (C) | ||
# 2005-2007 by C. Titus Brown. It is released under the MIT license; | ||
# please see the included LICENSE.txt file for more information, or | ||
# go to http://www.opensource.org/licenses/mit-license.php. | ||
|
||
""" | ||
twill Web testing language & associated utilities. | ||
""" | ||
|
||
__version__ = "0.9" | ||
|
||
#import warnings | ||
#warnings.defaultaction = "error" | ||
|
||
#import pychecker.checker | ||
|
||
__all__ = [ "TwillCommandLoop", | ||
"execute_file", | ||
"execute_string", | ||
"get_browser", | ||
"add_wsgi_intercept", | ||
"remove_wsgi_intercept", | ||
"set_output", | ||
"set_errout"] | ||
|
||
# | ||
# add extensions (twill/extensions) and the the wwwsearch & pyparsing | ||
# stuff from twill/included-packages/. NOTE: this works with eggs! hooray! | ||
# | ||
|
||
import sys, os.path | ||
thisdir = os.path.dirname(__file__) | ||
|
||
# add extensions directory at the *end* of sys.path. This means that | ||
# user extensions will take priority over twill extensions. | ||
extensions = os.path.join(thisdir, 'extensions') | ||
sys.path.append(extensions) | ||
|
||
# add other_packages in at the *beginning*, so that the correct | ||
# (patched) versions of pyparsing and mechanize get imported. | ||
wwwsearchlib = os.path.join(thisdir, 'other_packages') | ||
sys.path.insert(0, wwwsearchlib) | ||
|
||
# the two core components of twill: | ||
from .shell import TwillCommandLoop | ||
from .parse import execute_file, execute_string | ||
|
||
# convenience function or two... | ||
from .commands import get_browser | ||
|
||
def get_browser_state(): | ||
import warnings | ||
warnings.warn("""\ | ||
get_browser_state is deprecated; use 'twill.get_browser() instead. | ||
""", DeprecationWarning) | ||
return get_browser() | ||
|
||
# initialize global dict | ||
from . import namespaces | ||
namespaces.init_global_dict() | ||
|
||
from .wsgi_intercept import add_wsgi_intercept, remove_wsgi_intercept | ||
|
||
def set_output(fp): | ||
""" | ||
Have standard output from twill go to the given fp instead of | ||
stdout. fp=None will reset to stdout. | ||
""" | ||
from . import commands, browser | ||
commands.OUT = browser.OUT = fp | ||
|
||
def set_errout(fp): | ||
""" | ||
Have error output from twill go to the given fp instead of stderr. | ||
fp=None will reset to stderr. | ||
""" | ||
from . import commands | ||
if fp: | ||
commands.ERR = fp | ||
else: | ||
commands.ERR = sys.stderr |
Oops, something went wrong.