Further shuffling to get this to fit the standard code layout

* Move tests and code into elastic_recheck
* Get 'tox -epy27' working
* Tweak setup.cfg for elastic_recheck

The goal here is: pip install elastic-recheck, import elastic_recheck

Change-Id: Iab9fdf49dc51127a826f0908da3c238c49cbe434
This commit is contained in:
Joe Gordon 2013-09-25 18:15:33 -07:00
parent adb6ac6164
commit 20a2caf85e
9 changed files with 27 additions and 31 deletions

View File

@ -28,6 +28,16 @@ import time
logging.basicConfig()
REQUIRED_FILES = [
'console.html',
'logs/screen-key.txt',
'logs/screen-n-api.txt',
'logs/screen-n-cpu.txt',
'logs/screen-n-sch.txt',
'logs/screen-c-api.txt',
'logs/screen-c-vol.txt'
]
class Stream(object):
"""Gerrit Stream.
@ -205,16 +215,7 @@ class Classifier():
results = self.es.search(query, size='80')
files = results['facets']['tag']['terms']
files = [x['term'] for x in files]
required_files = [
'console.html',
'logs/screen-key.txt',
'logs/screen-n-api.txt',
'logs/screen-n-cpu.txt',
'logs/screen-n-sch.txt',
'logs/screen-c-api.txt',
'logs/screen-c-vol.txt'
]
missing_files = [x for x in required_files if x not in files]
missing_files = [x for x in REQUIRED_FILES if x not in files]
if len(missing_files) is 0:
break
else:
@ -233,16 +234,6 @@ class Classifier():
class RequiredFiles(object):
required_files = [
'console.html',
'logs/screen-key.txt',
'logs/screen-n-api.txt',
'logs/screen-n-cpu.txt',
'logs/screen-n-sch.txt',
'logs/screen-c-api.txt',
'logs/screen-c-vol.txt'
]
@staticmethod
def prep_url(url):
if isinstance(url, list):
@ -254,12 +245,16 @@ class RequiredFiles(object):
@staticmethod
def files_at_url(url):
for f in RequiredFiles.required_files:
for f in REQUIRED_FILES:
try:
urllib2.urlopen(url + '/' + f).code
except urllib2.HTTPError:
# File does not exist at URL
return False
try:
urllib2.urlopen(url + '/' + f + '.gz').code
except urllib2.HTTPError:
# File does not exist at URL
print f
return False
return True

View File

View File

@ -26,8 +26,9 @@ class TestGerritComment(testtools.TestCase):
config = ConfigParser.ConfigParser({'server_password': None})
config.read('elasticRecheck.conf')
self.user = config.get('gerrit', 'user')
key = config.get('gerrit', 'key')
host = 'review-dev.openstack.org'
self.stream = elasticRecheck.Stream(self.user, host, thread=False)
self.stream = elasticRecheck.Stream(self.user, host, key, thread=False)
port = 29418
self.gerrit = gerritlib.gerrit.Gerrit(host, self.user, port)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import elasticRecheck
from elastic_recheck import elasticRecheck
import testtools

View File

@ -21,7 +21,7 @@ classifier =
[files]
packages =
elastic-recheck
elastic_recheck
[build_sphinx]
source-dir = doc/source
@ -32,15 +32,15 @@ all_files = 1
upload-dir = doc/build/html
[compile_catalog]
directory = elastic-recheck/locale
domain = elastic-recheck
directory = elastic_recheck/locale
domain = elastic_recheck
[update_catalog]
domain = elastic-recheck
output_dir = elastic-recheck/locale
input_file = elastic-recheck/locale/elastic-recheck.pot
output_dir = elastic_recheck/locale
input_file = elastic_recheck/locale/elastic-recheck.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = elastic-recheck/locale/elastic-recheck.pot
output_file = elastic_recheck/locale/elastic-recheck.pot