Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from iferguson90/master
Browse files Browse the repository at this point in the history
Testing environment variables
  • Loading branch information
davidlmorton committed Jun 10, 2014
2 parents 4e932e1 + e0247c0 commit b925ef6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
5 changes: 1 addition & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ def this_dir():
def procfile_path():
return os.path.join(this_dir(), 'scripts', 'Procfile')

def env_path():
return os.path.join(this_dir(), 'scripts', 'environment.txt')

def service_command_line():
return ['honcho', '-f', procfile_path(), '-e', env_path(), 'start',
return ['honcho', '-f', procfile_path(), 'start',
'-c', 'worker=%s' % NUM_WORKERS]


Expand Down
4 changes: 2 additions & 2 deletions tests/api/v1/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class BaseAPITest(unittest.TestCase):
__metaclass__ = abc.ABCMeta

def setUp(self):
self.api_host = os.environ.setdefault('PTERO_FORK_HOST', 'localhost')
self.api_port = os.environ.setdefault('PTERO_FORK_PORT', '5200')
self.api_host = os.environ['PTERO_FORK_HOST']
self.api_port = os.environ['PTERO_FORK_PORT']

def create_callback_server(self, response_codes):
server = CallbackServer(response_codes)
Expand Down
8 changes: 4 additions & 4 deletions tests/scripts/Procfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rabbit: RABBITMQ_LOG_BASE=$PWD/$RABBITMQ_LOG_BASE RABBITMQ_MNESIA_BASE=$PWD/$RABBITMQ_MNESIA_BASE rabbitmq-server
redis: redis-server --port $REDIS_PORT
web: python tests/scripts/web_wrapper.py
worker: coverage run $(which celery) worker -n shell_worker.%h.$PORT --pool=eventlet --concurrency 1 -A ptero_shell_command_fork.implementation.celery_app
rabbit: RABBITMQ_LOG_BASE=$PWD/$PTERO_FORK_RABBITMQ_LOG_BASE RABBITMQ_MNESIA_BASE=$PWD/$PTERO_FORK_RABBITMQ_MNESIA_BASE RABBITMQ_NODENAME=$PTERO_FORK_RABBITMQ_NODENAME RABBITMQ_NODE_PORT=$PTERO_FORK_RABBITMQ_NODE_PORT rabbitmq-server
redis: redis-server --port $PTERO_FORK_REDIS_PORT
web: CELERY_BROKER_URL=$PTERO_FORK_CELERY_BROKER_URL CELERY_RESULT_BACKEND=$PTERO_FORK_CELERY_RESULT_BACKEND python tests/scripts/web_wrapper.py
worker: CELERY_BROKER_URL=$PTERO_FORK_CELERY_BROKER_URL CELERY_RESULT_BACKEND=$PTERO_FORK_CELERY_RESULT_BACKEND coverage run $(which celery) worker -n shell_worker.%h.$PORT --pool=eventlet --concurrency 1 -A ptero_shell_command_fork.implementation.celery_app
9 changes: 0 additions & 9 deletions tests/scripts/environment.txt

This file was deleted.

4 changes: 2 additions & 2 deletions tests/scripts/web_service.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from ptero_shell_command_fork.api.wsgi import app
import os

port = int(os.environ.get('PTERO_FORK_PORT', '5200'))
host = os.environ.get('PTERO_FORK_HOST', 'localhost')
port = int(os.environ['PTERO_FORK_PORT'])
host = os.environ['PTERO_FORK_HOST']


app.run(host=host, port=port, debug=False, use_reloader=False)
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ whitelist_externals =
rm
setenv =
PYTHONPATH=.
PTERO_FORK_CELERY_BROKER_URL=amqp://localhost:5999
PTERO_FORK_CELERY_RESULT_BACKEND=redis://localhost:5998
PTERO_FORK_REDIS_PORT=5998
PTERO_FORK_RABBITMQ_LOG_BASE=var/log
PTERO_FORK_RABBITMQ_MNESIA_BASE=var/rabbitmq-data
PTERO_FORK_RABBITMQ_NODENAME=ptero-fork-rabbitmq
PTERO_FORK_RABBITMQ_NODE_PORT=5999
PTERO_FORK_HOST=localhost
PTERO_FORK_PORT=5200
commands =
rm -rf {toxinidir}/var
coverage combine
Expand Down

0 comments on commit b925ef6

Please sign in to comment.