Skip to content

Commit

Permalink
Make generate_objects.py and rand_readwrite.py inside the package.
Browse files Browse the repository at this point in the history
Handle dependencies properly. Now e.g. "./bootstrap &&
./virtualenv/bin/s3tests-test-readwrite" should just work.
  • Loading branch information
Tommi Virtanen committed Jul 13, 2011
1 parent 33b25c5 commit 02a4c82
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@
*.pyc
*.pyo

/*.egg-info
/virtualenv

config.yml
24 changes: 24 additions & 0 deletions bootstrap
@@ -1,4 +1,28 @@
#!/bin/sh
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

# avoid pip bugs
./virtualenv/bin/pip install --upgrade pip

./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
2 changes: 2 additions & 0 deletions requirements.txt
Expand Up @@ -2,3 +2,5 @@ PyYAML
nose >=1.0.0
boto >=2.0b4
bunch >=1.0.0
# 0.14 switches to libev, that means bootstrap needs to change too
gevent ==0.13.6
File renamed without changes.
10 changes: 5 additions & 5 deletions generate_objects.py → s3tests/generate_objects.py 100755 → 100644
Expand Up @@ -2,10 +2,10 @@

from boto.s3.key import Key
from optparse import OptionParser
import realistic
from . import realistic
import traceback
import random
import common
from . import common
import sys


Expand Down Expand Up @@ -54,7 +54,7 @@ def upload_objects(bucket, files, seed):
return keys


def main():
def _main():
'''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:
S3TEST_CONF=config.yml virtualenv/bin/python generate_objects.py -O urls.txt --seed 1234
Expand Down Expand Up @@ -106,10 +106,10 @@ def main():
print >> sys.stderr, 'done'


if __name__ == '__main__':
def main():
common.setup()
try:
main()
_main()
except Exception as e:
traceback.print_exc()
common.teardown()
3 changes: 0 additions & 3 deletions rand_readwrite.py → s3tests/rand_readwrite.py 100755 → 100644
Expand Up @@ -194,6 +194,3 @@ def main():
# cleanup
if options.cleanup:
common.teardown()

if __name__ == "__main__":
main()
File renamed without changes.
29 changes: 29 additions & 0 deletions setup.py
@@ -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',
],
},

)

0 comments on commit 02a4c82

Please sign in to comment.