Make generate_objects.py and rand_readwrite.py inside the package.

Handle dependencies properly. Now e.g. "./bootstrap &&
./virtualenv/bin/s3tests-test-readwrite" should just work.
This commit is contained in:
Tommi Virtanen 2011-07-13 13:52:54 -07:00
parent 33b25c577e
commit 02a4c82dfa
8 changed files with 61 additions and 8 deletions

1
.gitignore vendored
View file

@ -8,6 +8,7 @@
*.pyc *.pyc
*.pyo *.pyo
/*.egg-info
/virtualenv /virtualenv
config.yml config.yml

View file

@ -1,4 +1,28 @@
#!/bin/sh #!/bin/sh
set -e set -e
for package in python-pip python-virtualenv python-dev libevent-dev; do
if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
# add a space after old values
missing="${missing:+$missing }$package"
fi
done
if [ -n "$missing" ]; then
echo "$0: missing required packages, please install them:" 1>&2
echo "sudo apt-get install $missing"
exit 1
fi
virtualenv --no-site-packages --distribute virtualenv virtualenv --no-site-packages --distribute virtualenv
# avoid pip bugs
./virtualenv/bin/pip install --upgrade pip
./virtualenv/bin/pip install -r requirements.txt ./virtualenv/bin/pip install -r requirements.txt
# forbid setuptools from using the network because it'll try to use
# easy_install, and we really wanted pip; next line will fail if pip
# requirements.txt does not match setup.py requirements -- sucky but
# good enough for now
./virtualenv/bin/python setup.py develop \
--allow-hosts None

View file

@ -2,3 +2,5 @@ PyYAML
nose >=1.0.0 nose >=1.0.0
boto >=2.0b4 boto >=2.0b4
bunch >=1.0.0 bunch >=1.0.0
# 0.14 switches to libev, that means bootstrap needs to change too
gevent ==0.13.6

10
generate_objects.py → s3tests/generate_objects.py Executable file → Normal file
View file

@ -2,10 +2,10 @@
from boto.s3.key import Key from boto.s3.key import Key
from optparse import OptionParser from optparse import OptionParser
import realistic from . import realistic
import traceback import traceback
import random import random
import common from . import common
import sys import sys
@ -54,7 +54,7 @@ def upload_objects(bucket, files, seed):
return keys return keys
def main(): def _main():
'''To run the static content load test, make sure you've bootstrapped your '''To run the static content load test, make sure you've bootstrapped your
test environment and set up your config.yml file, then run the following: test environment and set up your config.yml file, then run the following:
S3TEST_CONF=config.yml virtualenv/bin/python generate_objects.py -O urls.txt --seed 1234 S3TEST_CONF=config.yml virtualenv/bin/python generate_objects.py -O urls.txt --seed 1234
@ -106,10 +106,10 @@ def main():
print >> sys.stderr, 'done' print >> sys.stderr, 'done'
if __name__ == '__main__': def main():
common.setup() common.setup()
try: try:
main() _main()
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
common.teardown() common.teardown()

3
rand_readwrite.py → s3tests/rand_readwrite.py Executable file → Normal file
View file

@ -194,6 +194,3 @@ def main():
# cleanup # cleanup
if options.cleanup: if options.cleanup:
common.teardown() common.teardown()
if __name__ == "__main__":
main()

29
setup.py Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/python
from setuptools import setup, find_packages
setup(
name='s3tests',
version='0.0.1',
packages=find_packages(),
author='Tommi Virtanen',
author_email='tommi.virtanen@dreamhost.com',
description='Unofficial Amazon AWS S3 compatibility tests',
license='MIT',
keywords='s3 web testing',
install_requires=[
'boto >=2.0b4',
'PyYAML',
'bunch >=1.0.0',
'gevent ==0.13.6',
],
entry_points={
'console_scripts': [
's3tests-generate-objects = s3tests.generate_objects:main',
's3tests-test-readwrite = s3tests.rand_readwrite:main',
],
},
)