diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d00f6d..07bc9ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: test: docker: - - image: circleci/python:2.7.16-browsers + - image: circleci/python:3.5-browsers steps: - checkout - run: @@ -26,7 +26,7 @@ jobs: when: always quality: docker: - - image: circleci/python:2.7.16 + - image: circleci/python:3.5 steps: - checkout - run: @@ -36,12 +36,6 @@ jobs: virtualenv ./venv . venv/bin/activate pip install tox pylint - - run: - name: Run quality tests - command: | - . venv/bin/activate - tox -e quality - when: always - run: name: Run python3 quality tests command: | diff --git a/image_explorer/image_explorer.py b/image_explorer/image_explorer.py index c9075e9..0eb6fc2 100644 --- a/image_explorer/image_explorer.py +++ b/image_explorer/image_explorer.py @@ -354,7 +354,7 @@ def _inner_content(self, tag, absolute_urls=False): Helper met """ if tag is not None: - tag_content = u''.join(html.tostring(e) for e in tag) + tag_content = ''.join([ html.tostring(e, encoding=str) for e in tag ]) if absolute_urls: return self._change_relative_url_to_absolute(tag_content) return tag_content diff --git a/requirements.txt b/requirements.txt index d50cb8a..17c348f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -e . --e git+https://github.com/edx/xblock-utils.git@v1.1.0#egg=xblock-utils==1.1.0 -edx-i18n-tools==0.4.7 -lxml==3.0.1 -mako==1.0.7 -parsel==1.2.0 -transifex-client==0.13.4 +-e git+https://github.com/edx/xblock-utils.git@2.1.1#egg=xblock-utils==2.1.1 +edx-i18n-tools==0.5.3 +lxml==4.5.2 +mako==1.1.3 +parsel==1.6.0 +transifex-client==0.13.11 diff --git a/run_tests.py b/run_tests.py index 04b356c..7cdae9f 100644 --- a/run_tests.py +++ b/run_tests.py @@ -32,7 +32,7 @@ from django.conf import settings settings.INSTALLED_APPS += ("image_explorer", ) - for noisy_logger, log_level in logging_level_overrides.iteritems(): + for noisy_logger, log_level in logging_level_overrides.items(): logging.getLogger(noisy_logger).setLevel(log_level) from django.core.management import execute_from_command_line diff --git a/setup.py b/setup.py index 4dd27b7..1d63d07 100644 --- a/setup.py +++ b/setup.py @@ -23,11 +23,12 @@ def package_data(pkg, root_list): setup( name='xblock-image-explorer', - version='1.2', + version='2.0', description='XBlock - Image Explorer', packages=['image_explorer'], install_requires=[ 'XBlock>=1.2', + 'parsel>=1.6.0,<=1.6.0', ], entry_points={ 'xblock.v1': 'image-explorer = image_explorer:ImageExplorerBlock', diff --git a/tests/integration/test_image_explorer.py b/tests/integration/test_image_explorer.py index 10aa3ca..f30eaa7 100644 --- a/tests/integration/test_image_explorer.py +++ b/tests/integration/test_image_explorer.py @@ -17,7 +17,7 @@ def hotspots(self, block): for h in hotspots: h.content = h.find_element_by_css_selector(".image-explorer-hotspot-reveal") h.close_button = h.find_element_by_css_selector(".image-explorer-close-reveal") - h.is_clickable = types.MethodType(lambda s: s.is_displayed() and s.is_enabled(), h, type(h)) + h.is_clickable = types.MethodType(lambda s: s.is_displayed() and s.is_enabled(), h) return {h.get_attribute("data-item-id"): h for h in hotspots} def decorate_block(self, block): diff --git a/tests/unit/test_image_explorer.py b/tests/unit/test_image_explorer.py index 69686fd..f1e56f2 100644 --- a/tests/unit/test_image_explorer.py +++ b/tests/unit/test_image_explorer.py @@ -189,7 +189,7 @@ def test_collect_video_elements(self): image_explorer_block._collect_video_elements(hotspot_with_videos, feedback) # check if feedback has video elements attached - self.assertTrue(feedback.has_key('youtube')) + self.assertTrue('youtube' in feedback) self.assertEqual(feedback.youtube.video_id, 'dmoZXcuozFQ') - self.assertTrue(feedback.has_key('bcove')) + self.assertTrue('bcove' in feedback) self.assertEqual(feedback.bcove.video_id, '1234') diff --git a/tox.ini b/tox.ini index 2f2399d..80e513e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,18 @@ [tox] -envlist = unit,integration,quality,python3-quality +envlist = unit,integration,python3-quality [testenv] whitelist_externals = make commands_pre = - pip install -e 'git://github.com/edx/xblock-sdk.git@v0.1.7#egg=xblock-sdk==0.1.7' + pip install -e 'git://github.com/edx/xblock-sdk.git@0.2.2#egg=xblock-sdk==0.2.2' make -C {envdir}/src/xblock-sdk/ install pip install -r requirements.txt + # upgrade both bok-choy and selenium to avoid BrokenPromise Error + # caused due to deprecated chromeOptions issue + pip install selenium==3.141.0 bok-choy==1.1.1 + [testenv:unit] commands = python run_tests.py tests/unit @@ -18,10 +22,6 @@ passenv = * commands = python run_tests.py tests/integration -[testenv:quality] -commands = - pylint image_explorer - [testenv:python3-quality] commands = pylint --py3k image_explorer