Skip to content

Commit

Permalink
fix: review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed Oct 25, 2023
1 parent b607ad5 commit b427fea
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ These are notable changes in XBlock.
Unreleased
----------

1.8.2 - Unreleased
2.0.0 - Unreleased
------------------

* Removed deprecations
Expand Down
2 changes: 1 addition & 1 deletion docs/xblock-utils/settings-and-theme-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/openedx/web-fragments/blob/master/web_fragments/fragment.py>`__
instance.

Expand Down
2 changes: 1 addition & 1 deletion xblock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
27 changes: 25 additions & 2 deletions xblock/test/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b427fea

Please sign in to comment.