From 9da3a18b0fab338a1613266b9d8ad7189c5c2043 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Fri, 9 Oct 2015 23:42:56 -0700 Subject: [PATCH 1/2] Fix: Don't import all the problem builder blocks when the django app is loaded. --- problem_builder/__init__.py | 9 ------- .../tests/integration/base_test.py | 2 +- problem_builder/tests/integration/test_mcq.py | 2 +- .../tests/integration/test_mentoring.py | 2 +- problem_builder/tests/unit/test_mentoring.py | 3 +-- problem_builder/tests/unit/test_migration.py | 2 +- problem_builder/v1/tests/test_upgrade.py | 2 +- setup.py | 24 +++++++++---------- 8 files changed, 18 insertions(+), 28 deletions(-) diff --git a/problem_builder/__init__.py b/problem_builder/__init__.py index cf1ee771..e69de29b 100644 --- a/problem_builder/__init__.py +++ b/problem_builder/__init__.py @@ -1,9 +0,0 @@ -from .mentoring import MentoringBlock -from .answer import AnswerBlock, AnswerRecapBlock -from .choice import ChoiceBlock -from .dashboard import DashboardBlock -from .mcq import MCQBlock, RatingBlock -from .mrq import MRQBlock -from .message import MentoringMessageBlock -from .table import MentoringTableBlock, MentoringTableColumn -from .tip import TipBlock diff --git a/problem_builder/tests/integration/base_test.py b/problem_builder/tests/integration/base_test.py index 4b90884f..6a54eabe 100644 --- a/problem_builder/tests/integration/base_test.py +++ b/problem_builder/tests/integration/base_test.py @@ -24,7 +24,7 @@ # Studio adds a url_name property to each XBlock but Workbench doesn't. # Since we rely on it, we need to mock url_name support so it can be set via XML and # accessed like a normal field. -from problem_builder import MentoringBlock +from problem_builder.mentoring import MentoringBlock MentoringBlock.url_name = String() diff --git a/problem_builder/tests/integration/test_mcq.py b/problem_builder/tests/integration/test_mcq.py index 9cfc1680..f100e12d 100644 --- a/problem_builder/tests/integration/test_mcq.py +++ b/problem_builder/tests/integration/test_mcq.py @@ -23,7 +23,7 @@ import ddt from mock import patch, Mock -from problem_builder import MentoringBlock +from problem_builder.mentoring import MentoringBlock from .base_test import MentoringBaseTest diff --git a/problem_builder/tests/integration/test_mentoring.py b/problem_builder/tests/integration/test_mentoring.py index 2f3863ef..7d75d1a2 100644 --- a/problem_builder/tests/integration/test_mentoring.py +++ b/problem_builder/tests/integration/test_mentoring.py @@ -69,6 +69,6 @@ def assert_status_icon_color(self, color): ('apros', "#ff0000") ) def test_lms_theme_applied(self, theme, expected_color): - with mock.patch("problem_builder.MentoringBlock.get_theme") as patched_theme: + with mock.patch("problem_builder.mentoring.MentoringBlock.get_theme") as patched_theme: patched_theme.return_value = _get_mentoring_theme_settings(theme) self.assert_status_icon_color(expected_color) diff --git a/problem_builder/tests/unit/test_mentoring.py b/problem_builder/tests/unit/test_mentoring.py index 5452e958..2ba2c3d4 100644 --- a/problem_builder/tests/unit/test_mentoring.py +++ b/problem_builder/tests/unit/test_mentoring.py @@ -2,8 +2,7 @@ import ddt from mock import MagicMock, Mock, patch from xblock.field_data import DictFieldData -from problem_builder import MentoringBlock -from problem_builder.mentoring import _default_theme_config +from problem_builder.mentoring import MentoringBlock, _default_theme_config class TestMentoringBlock(unittest.TestCase): diff --git a/problem_builder/tests/unit/test_migration.py b/problem_builder/tests/unit/test_migration.py index 412027ae..dc70fd42 100644 --- a/problem_builder/tests/unit/test_migration.py +++ b/problem_builder/tests/unit/test_migration.py @@ -1,5 +1,5 @@ import copy -from problem_builder import MentoringBlock +from problem_builder.mentoring import MentoringBlock from mock import MagicMock, Mock import unittest from xblock.field_data import DictFieldData diff --git a/problem_builder/v1/tests/test_upgrade.py b/problem_builder/v1/tests/test_upgrade.py index 828a9f71..0544e661 100644 --- a/problem_builder/v1/tests/test_upgrade.py +++ b/problem_builder/v1/tests/test_upgrade.py @@ -22,7 +22,7 @@ """ import ddt from lxml import etree -from problem_builder import MentoringBlock +from problem_builder.mentoring import MentoringBlock from problem_builder.v1.xml_changes import convert_xml_v1_to_v2 import os.path from StringIO import StringIO diff --git a/setup.py b/setup.py index 86f792ef..8f1e4c48 100644 --- a/setup.py +++ b/setup.py @@ -40,20 +40,20 @@ def package_data(pkg, root_list): # Main ############################################################## BLOCKS = [ - 'problem-builder = problem_builder:MentoringBlock', + 'problem-builder = problem_builder.mentoring:MentoringBlock', - 'pb-table = problem_builder:MentoringTableBlock', - 'pb-column = problem_builder:MentoringTableColumn', - 'pb-answer = problem_builder:AnswerBlock', - 'pb-answer-recap = problem_builder:AnswerRecapBlock', - 'pb-mcq = problem_builder:MCQBlock', - 'pb-rating = problem_builder:RatingBlock', - 'pb-mrq = problem_builder:MRQBlock', - 'pb-message = problem_builder:MentoringMessageBlock', - 'pb-tip = problem_builder:TipBlock', - 'pb-choice = problem_builder:ChoiceBlock', + 'pb-table = problem_builder.table:MentoringTableBlock', + 'pb-column = problem_builder.table:MentoringTableColumn', + 'pb-answer = problem_builder.answer:AnswerBlock', + 'pb-answer-recap = problem_builder.answer:AnswerRecapBlock', + 'pb-mcq = problem_builder.mcq:MCQBlock', + 'pb-rating = problem_builder.mcq:RatingBlock', + 'pb-mrq = problem_builder.mrq:MRQBlock', + 'pb-message = problem_builder.message:MentoringMessageBlock', + 'pb-tip = problem_builder.tip:TipBlock', + 'pb-choice = problem_builder.choice:ChoiceBlock', - 'pb-dashboard = problem_builder:DashboardBlock', + 'pb-dashboard = problem_builder.dashboard:DashboardBlock', # Deprecated. You can temporarily uncomment and run 'python setup.py develop' if you have these blocks # installed from testing mentoring v2 and need to get past an error message. #'mentoring = problem_builder:MentoringBlock', # Deprecated alias for problem-builder From 7263e3476c066c3fea61aeefc548300945afbc76 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Fri, 9 Oct 2015 21:26:59 -0700 Subject: [PATCH 2/2] Fix Travis CI build broken by new Selenium release (2.48.0) --- test_requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_requirements.txt b/test_requirements.txt index 7b7a84e8..71ac283c 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1 +1,2 @@ --e git+https://github.com/edx/XBlock.git@496d3cb9aca1d9e0a18b0f5e73c7bede824e465f#egg=XBlock \ No newline at end of file +-e git+https://github.com/edx/XBlock.git@496d3cb9aca1d9e0a18b0f5e73c7bede824e465f#egg=XBlock +selenium==2.47.3 # 2.48 is not working atm