Commit 352e56eb by Chris Dodge

address some pylint violations in the mixedmodulestore build report

parent 606e8b1d
...@@ -7,7 +7,7 @@ IMPORTANT: This modulestore only supports READONLY applications, e.g. LMS ...@@ -7,7 +7,7 @@ IMPORTANT: This modulestore only supports READONLY applications, e.g. LMS
""" """
from . import ModuleStoreBase from . import ModuleStoreBase
from django import create_modulestore_instance from xmodule.modulestore.django import create_modulestore_instance
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -13,7 +13,7 @@ HOST = 'localhost' ...@@ -13,7 +13,7 @@ HOST = 'localhost'
PORT = 27017 PORT = 27017
DB = 'test_mongo_%s' % uuid4().hex DB = 'test_mongo_%s' % uuid4().hex
COLLECTION = 'modulestore' COLLECTION = 'modulestore'
FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item FS_ROOT = DATA_DIR
DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor'
RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': '' RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': ''
...@@ -54,6 +54,9 @@ class TestMixedModuleStore(object): ...@@ -54,6 +54,9 @@ class TestMixedModuleStore(object):
'''Tests!''' '''Tests!'''
@classmethod @classmethod
def setupClass(cls): def setupClass(cls):
"""
Set up the database for testing
"""
cls.connection = pymongo.connection.Connection(HOST, PORT) cls.connection = pymongo.connection.Connection(HOST, PORT)
cls.connection.drop_database(DB) cls.connection.drop_database(DB)
cls.fake_location = Location(['i4x', 'foo', 'bar', 'vertical', 'baz']) cls.fake_location = Location(['i4x', 'foo', 'bar', 'vertical', 'baz'])
...@@ -66,10 +69,16 @@ class TestMixedModuleStore(object): ...@@ -66,10 +69,16 @@ class TestMixedModuleStore(object):
@classmethod @classmethod
def teardownClass(cls): def teardownClass(cls):
"""
Clear out database after test has completed
"""
cls.destroy_db(cls.connection) cls.destroy_db(cls.connection)
@staticmethod @staticmethod
def initdb(): def initdb():
"""
Initialize the database and import one test course into it
"""
# connect to the db # connect to the db
_options = {} _options = {}
_options.update(OPTIONS) _options.update(OPTIONS)
...@@ -92,7 +101,9 @@ class TestMixedModuleStore(object): ...@@ -92,7 +101,9 @@ class TestMixedModuleStore(object):
@staticmethod @staticmethod
def destroy_db(connection): def destroy_db(connection):
# Destroy the test db. """
Destroy the test db.
"""
connection.drop_database(DB) connection.drop_database(DB)
def setUp(self): def setUp(self):
...@@ -204,6 +215,7 @@ class TestMixedModuleStore(object): ...@@ -204,6 +215,7 @@ class TestMixedModuleStore(object):
module = self.store.get_course(XML_COURSEID2) module = self.store.get_course(XML_COURSEID2)
assert_equals(module.location.course, 'simple') assert_equals(module.location.course, 'simple')
# pylint: disable=E1101
def test_get_parent_locations(self): def test_get_parent_locations(self):
parents = self.store.get_parent_locations( parents = self.store.get_parent_locations(
Location(['i4x', self.import_org, self.import_course, 'chapter', 'Overview']), Location(['i4x', self.import_org, self.import_course, 'chapter', 'Overview']),
...@@ -223,6 +235,7 @@ class TestMixedModuleStore(object): ...@@ -223,6 +235,7 @@ class TestMixedModuleStore(object):
assert_equals(Location(parents[0]).course, 'toy') assert_equals(Location(parents[0]).course, 'toy')
assert_equals(Location(parents[0]).name, '2012_Fall') assert_equals(Location(parents[0]).name, '2012_Fall')
# pylint: disable=W0212
def test_set_modulestore_configuration(self): def test_set_modulestore_configuration(self):
config = {'foo': 'bar'} config = {'foo': 'bar'}
self.store.set_modulestore_configuration(config) self.store.set_modulestore_configuration(config)
......
...@@ -6,7 +6,7 @@ This configuration is to run the MixedModuleStore on a localdev environment ...@@ -6,7 +6,7 @@ This configuration is to run the MixedModuleStore on a localdev environment
# want to import all variables from base settings files # want to import all variables from base settings files
# pylint: disable=W0401, W0614 # pylint: disable=W0401, W0614
from .dev import *, DATA_DIR from .dev import *
MODULESTORE = { MODULESTORE = {
'default': { 'default': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment