From e92847eae88a13cf9c6f407112c2a42b7c46e808 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 7 Aug 2014 15:06:09 -0300 Subject: Victor/Bruno: Removing APP_ROOT workaround from app and tests --- service/app/__init__.py | 3 --- service/app/pixelated_user_agent.py | 5 ++++- service/go | 9 +++++---- service/runtests | 2 +- service/test/__init__.py | 3 --- service/test/search/test_search_query.py | 1 - 6 files changed, 10 insertions(+), 13 deletions(-) (limited to 'service') diff --git a/service/app/__init__.py b/service/app/__init__.py index acb5b492..8b137891 100644 --- a/service/app/__init__.py +++ b/service/app/__init__.py @@ -1,4 +1 @@ -import sys -import os -sys.path.insert(0, os.environ['APP_ROOT']) diff --git a/service/app/pixelated_user_agent.py b/service/app/pixelated_user_agent.py index d13a7fdc..fb71a6f5 100644 --- a/service/app/pixelated_user_agent.py +++ b/service/app/pixelated_user_agent.py @@ -112,10 +112,13 @@ def draft_reply_for(mail_id): def index(): return app.send_static_file('index.html') -if __name__ == '__main__': +def setup(): app.config.from_envvar('PIXELATED_UA_CFG') account = app.config['ACCOUNT'] mail_service = MailService() converter = MailConverter(mail_service) app.run(host=app.config['HOST'], debug=app.config['DEBUG'], port=app.config['PORT']) + +if __name__ == '__main__': + setup() diff --git a/service/go b/service/go index 1342660b..d0d83096 100755 --- a/service/go +++ b/service/go @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env python +from app.pixelated_user_agent import setup +import os +os.environ['PIXELATED_UA_CFG']='../config/pixelated_ua.cfg' +setup() -export PIXELATED_UA_CFG=../config/pixelated_ua.cfg -export APP_ROOT=. -python app/pixelated_user_agent.py diff --git a/service/runtests b/service/runtests index 6b10459a..458e8926 100755 --- a/service/runtests +++ b/service/runtests @@ -1,2 +1,2 @@ #!/bin/bash -APP_ROOT=`pwd` py.test test/ +py.test test/ diff --git a/service/test/__init__.py b/service/test/__init__.py index acb5b492..8b137891 100644 --- a/service/test/__init__.py +++ b/service/test/__init__.py @@ -1,4 +1 @@ -import sys -import os -sys.path.insert(0, os.environ['APP_ROOT']) diff --git a/service/test/search/test_search_query.py b/service/test/search/test_search_query.py index 85d9681d..a5f3be99 100644 --- a/service/test/search/test_search_query.py +++ b/service/test/search/test_search_query.py @@ -1,5 +1,4 @@ import sys, os -sys.path.insert(0, os.environ['APP_ROOT']) from app.search import SearchQuery -- cgit v1.2.3