diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 453c3f9d4..42da414a4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,7 +7,7 @@ These are notable changes in XBlock. Unreleased ---------- -1.8.2 - Unreleased +2.0.0 - Unreleased ------------------ * Removed deprecations diff --git a/docs/xblock-utils/settings-and-theme-support.rst b/docs/xblock-utils/settings-and-theme-support.rst index 8b4f35d98..b35422772 100644 --- a/docs/xblock-utils/settings-and-theme-support.rst +++ b/docs/xblock-utils/settings-and-theme-support.rst @@ -145,7 +145,7 @@ specified via settings. - ``include_theme_files(fragment)`` - this method is an entry point to ``ThemableXBlockMixin`` functionality. It calls ``get_theme`` to obtain theme configuration, fetches theme files and includes them - into fragment. ``fragment`` must be an + into fragment. ``fragment`` must be a `web_fragments.fragment `__ instance. diff --git a/xblock/__init__.py b/xblock/__init__.py index 221a539ce..82fc398f6 100644 --- a/xblock/__init__.py +++ b/xblock/__init__.py @@ -27,4 +27,4 @@ def __init__(self, *args, **kwargs): # without causing a circular import xblock.fields.XBlockMixin = XBlockMixin -__version__ = '1.8.1' +__version__ = '2.0.0' diff --git a/xblock/test/test_runtime.py b/xblock/test/test_runtime.py index 60a4fcab5..c7eb67773 100644 --- a/xblock/test/test_runtime.py +++ b/xblock/test/test_runtime.py @@ -15,7 +15,8 @@ NoSuchHandlerError, NoSuchServiceError, NoSuchUsage, - NoSuchViewError + NoSuchViewError, + FieldDataDeprecationWarning, ) from xblock.fields import BlockScope, Scope, String, ScopeIds, List, UserScope, Integer from xblock.runtime import ( @@ -28,7 +29,7 @@ ) from xblock.field_data import DictFieldData, FieldData -from xblock.test.tools import unabc, TestRuntime +from xblock.test.tools import unabc, WarningTestMixin, TestRuntime class TestMixin: @@ -649,6 +650,28 @@ def test_missing_definition(self): self.runtime.get_block(self.usage_id) +class TestRuntimeDeprecation(WarningTestMixin, TestCase): + """ + Tests to make sure that deprecated Runtime apis stay usable, + but raise warnings. + """ + + def test_passed_field_data(self): + field_data = Mock(spec=FieldData) + with self.assertWarns(FieldDataDeprecationWarning): + runtime = TestRuntime(Mock(spec=IdReader), field_data) + with self.assertWarns(FieldDataDeprecationWarning): + self.assertEqual(runtime.field_data, field_data) + + def test_set_field_data(self): + field_data = Mock(spec=FieldData) + runtime = TestRuntime(Mock(spec=IdReader), None) + with self.assertWarns(FieldDataDeprecationWarning): + runtime.field_data = field_data + with self.assertWarns(FieldDataDeprecationWarning): + self.assertEqual(runtime.field_data, field_data) + + class RuntimeWithCustomCSS(TestRuntime): # pylint: disable=abstract-method """ A runtime that adds extra CSS classes to rendered XBlocks