From 1f4dae68076f407f88c1b70d133c696befb74cc7 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Tue, 23 Apr 2013 17:50:17 -0700 Subject: [PATCH] code cleanup --- tests/model/derived/test_objectstore_model.py | 8 +++++--- treeherder/model/derived/base.py | 2 +- treeherder/model/derived/jobs.py | 14 -------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/model/derived/test_objectstore_model.py b/tests/model/derived/test_objectstore_model.py index 9d7aa86c3..4b51f0f6b 100644 --- a/tests/model/derived/test_objectstore_model.py +++ b/tests/model/derived/test_objectstore_model.py @@ -1,8 +1,7 @@ -import pytest import json -from .sample_data_generator import job_json, job_data, ref_data_json +from .sample_data_generator import job_json def test_unicode(jm): @@ -75,7 +74,7 @@ def test_mark_object_complete(jm): def test_process_objects(jm): - """Claims and processes a chunk of unprocessed JSON test data blobs.""" + """Claims and processes a chunk of unprocessed JSON jobs data blobs.""" # Load some rows into the objectstore blobs = [ job_json(submit_timestamp="1330454755"), @@ -106,6 +105,7 @@ def test_process_objects(jm): def test_process_objects_invalid_json(jm): + """process_objects fail for invalid json""" jm.store_job_data("invalid json") row_id = jm._get_last_insert_id("objectstore") @@ -122,6 +122,7 @@ def test_process_objects_invalid_json(jm): def test_process_objects_unknown_error(jm, monkeypatch): + """process_objects fail for unknown reason""" jm.store_job_data("{}") row_id = jm._get_last_insert_id("objectstore") @@ -143,6 +144,7 @@ def test_process_objects_unknown_error(jm, monkeypatch): def test_ingest_sample_data(jm, sample_data): + """Process all job structures in the job_data.txt file""" for blob in sample_data.job_data: # print blob jm.store_job_data(json.dumps(blob)) diff --git a/treeherder/model/derived/base.py b/treeherder/model/derived/base.py index e70f4e2e7..fefefa4b3 100644 --- a/treeherder/model/derived/base.py +++ b/treeherder/model/derived/base.py @@ -8,6 +8,7 @@ from django.conf import settings from treeherder.model.models import Datasource from treeherder.model.derived.refdata import RefDataManager + class TreeherderModelBase(object): """ Base model class for all derived models @@ -23,7 +24,6 @@ class TreeherderModelBase(object): self.DEBUG = settings.DEBUG self.refdata_model = RefDataManager() - def __unicode__(self): """Unicode representation is project name.""" return self.project diff --git a/treeherder/model/derived/jobs.py b/treeherder/model/derived/jobs.py index b070e46d6..bb96af801 100644 --- a/treeherder/model/derived/jobs.py +++ b/treeherder/model/derived/jobs.py @@ -32,21 +32,7 @@ class JobsModel(TreeherderModelBase): """ Create all the datasource tables for this project. - ``hosts`` is an optional dictionary mapping contenttype names to the - database server host on which the database for that contenttype should - be created. Not all contenttypes need to be represented; any that - aren't will use the default (``TREEHERDER_DATABASE_HOST``). - - ``types`` is an optional dictionary mapping contenttype names to the - type of database that should be created. For MySQL/MariaDB databases, - use "MySQL-Engine", where "Engine" could be "InnoDB", "Aria", etc. Not - all contenttypes need to be represented; any that aren't will use the - default (``MySQL-InnoDB``). - - """ - hosts = hosts or {} - types = types or {} for ct in [cls.CT_JOBS, cls.CT_OBJECTSTORE]: dataset = Datasource.get_latest_dataset(project, ct)