Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
[INCR-95]Run python-modernize on xblock-utils (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored and jmbowman committed Feb 26, 2019
1 parent 8953e29 commit 748d594
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ env:
- TOXENV=django111
- TOXENV=django20
- TOXENV=django21
- TOXENV=quality
matrix:
include:
- python: 2.7
env: TOXENV=quality
exclude:
- python: 2.7
env: TOXENV=django20
- python: 2.7
env: TOXENV=django21
allow_failures:
- python: 3.6
- python: 3.7
env: TOXENV=quality
allow_failures:
- env: TOXENV=django20
- env: TOXENV=django21

services:
- xvfb
Expand Down
1 change: 1 addition & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Run tests for XBlock-utils
"""

from __future__ import absolute_import
import os
import sys

Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#

from __future__ import absolute_import
import unittest

from xblockutils.base_test import SeleniumBaseTest
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_studio_editable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import datetime
import textwrap
import mock
Expand All @@ -12,6 +13,7 @@
from xblockutils.studio_editable import StudioEditableXBlockMixin, StudioContainerWithNestedXBlocksMixin, \
NestedXBlockSpec
from xblockutils.studio_editable_test import StudioEditableBaseTest, StudioContainerWithNestedXBlocksBaseTest
from six.moves import range


class EditableXBlock(StudioEditableXBlockMixin, XBlock):
Expand Down Expand Up @@ -218,6 +220,7 @@ def expect_error_message(expected_message):
def fancy_list_values_provider_a(block):
return [1, 2, 3, 4, 5]


def fancy_list_values_provider_b(block):
return [{"display_name": "Robert", "value": "bob"}, {"display_name": "Alexandra", "value": "alex"}]

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import absolute_import
from django.template import Context, Template
from xblockutils.resources import ResourceLoader

loader = ResourceLoader(__name__)


def render_template(template_path, context, **kwargs):
file_path = "tests/integration/template_stubs/"+template_path
file_path = "tests/integration/template_stubs/" + template_path

with open(file_path, 'r') as tpl_file:
template_str = tpl_file.read().replace('\n', '')
template = Template(template_str)
return template.render(Context(context))

1 change: 1 addition & 0 deletions tests/unit/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests for helpers.py
"""
from __future__ import absolute_import
import unittest
from workbench.runtime import WorkbenchRuntime
from xblock.core import XBlock
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_publish_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#

from __future__ import absolute_import
import unittest
import json

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#

from __future__ import absolute_import
import unittest
import gettext
from mock import patch, DEFAULT
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
import unittest
import ddt
import itertools
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ envlist = py{27,36,37}-django{111,20,21}
# We catch this with pylint, don't need 2 reports of the same issue
# E722: do not use bare except, specify exception instead
# We catch this with pylint, don't need 2 reports of the same issue
ignore=E402,E722
ignore=E402,E722,W504
exclude=.tox/
max-line-length = 120

Expand Down Expand Up @@ -39,6 +39,6 @@ deps =
commands =
{[base]commands}
pip install Django>=1.11,<2.2
pycodestyle xblockutils
pycodestyle .
pylint xblockutils
python setup.py check -r -s
1 change: 1 addition & 0 deletions xblockutils/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Base classes for Selenium or bok-choy based integration tests of XBlocks.
"""

from __future__ import absolute_import
import time

from selenium.webdriver.support.ui import WebDriverWait
Expand Down
1 change: 1 addition & 0 deletions xblockutils/publish_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
PublishEventMixin: A mixin for publishing events from an XBlock
"""

from __future__ import absolute_import
from xblock.core import XBlock


Expand Down
1 change: 1 addition & 0 deletions xblockutils/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""


from __future__ import absolute_import
import os
import sys
import warnings
Expand Down
1 change: 1 addition & 0 deletions xblockutils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
This module contains a mixins that allows third party XBlocks to access Settings Service in edX LMS.
"""
from __future__ import absolute_import
from xblockutils.resources import ResourceLoader


Expand Down
4 changes: 3 additions & 1 deletion xblockutils/studio_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

# Imports ###########################################################

from __future__ import absolute_import
import json
import logging

import six
from six import text_type

from xblock.core import XBlock
Expand Down Expand Up @@ -226,7 +228,7 @@ def submit_studio_edits(self, data, suffix=''):
)
self.validate_field_data(validation, preview_data)
if validation:
for field_name, value in values.iteritems():
for field_name, value in six.iteritems(values):
setattr(self, field_name, value)
for field_name in to_reset:
self.fields[field_name].delete_from(self)
Expand Down
1 change: 1 addition & 0 deletions xblockutils/studio_editable_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests for StudioEditableXBlockMixin
"""
from __future__ import absolute_import
from selenium.webdriver.support.ui import WebDriverWait
from xblockutils.base_test import SeleniumXBlockTest

Expand Down
1 change: 1 addition & 0 deletions xblockutils/templatetags/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Based on: https://github.com/eduNEXT/django-xblock-i18n
"""
from __future__ import absolute_import
from contextlib import contextmanager

from django.template import Library, Node
Expand Down

0 comments on commit 748d594

Please sign in to comment.