Commit c868900f by Brian Mesick Committed by GitHub

Add tox support, clean up quality violations (#45)

parent 9ccb1b4f
......@@ -4,3 +4,6 @@
cover
xblock_utils.egg-info
tests.integration.*.png
.idea/
.tox/
var/
......@@ -2,25 +2,26 @@ language: python
addons:
firefox: "52.0esr"
python:
- "2.7"
- 2.7
before_install:
- "export DISPLAY=:99"
- "sh -e /etc/init.d/xvfb start"
install:
- "pip install -e git://github.com/edx/xblock-sdk.git@22c1b2f173919bef22f2d9d9295ec5396d02dffd#egg=xblock-sdk"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/base.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.txt"
- "pip install -r requirements.txt"
- "pip install -r test_requirements.txt"
- "mkdir var"
- "wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz"
- "mkdir geckodriver"
- "tar -xzf geckodriver-v0.15.0-linux64.tar.gz -C geckodriver"
- "export PATH=$PATH:$PWD/geckodriver"
- "pip install tox"
env:
- TOX_ENV=django18
- TOX_ENV=django111
matrix:
include:
- python: 2.7
env: TOX_ENV=quality
script:
- pep8 xblockutils --max-line-length=120
- pylint xblockutils
- python run_tests.py --with-coverage --cover-package=xblockutils
- tox -e $TOX_ENV
notifications:
email: false
branches:
......
[tox]
envlist = py{27}-django{18,111}
# The ordering of deps and commands here is weird due to the way we install xblock-sdk and associated dependencies.
# Installing test/base.txt inside deps fails, and installing the env-specific Django versions inside deps
# causes Django 1.4 to be installed over it by something later in the process.
[base]
deps =
-rrequirements.txt
-rtest_requirements.txt
-egit+https://github.com/edx/xblock-sdk.git#egg=xblock-sdk
commands =
pip install -r {envdir}/src/xblock-sdk/requirements/test.txt
pip install -r {envdir}/src/xblock-sdk/requirements/base.txt
[testenv]
passenv = CI TRAVIS TRAVIS_* DISPLAY
deps =
{[base]deps}
commands =
{[base]commands}
django18: pip install Django>=1.8,<1.9
django110: pip install Django>=1.10,<1.11
django111: pip install Django>=1.11,<2.0
python ./run_tests.py --with-coverage --cover-package=xblockutils
[testenv:quality]
basepython = python2.7
deps =
{[base]deps}
commands =
{[base]commands}
pip install Django>=1.11,<2.0
pep8 xblockutils --max-line-length=120
pylint xblockutils
......@@ -35,8 +35,7 @@ class XBlockWithSettingsMixin(object):
settings_service = self.runtime.service(self, "settings")
if settings_service:
return settings_service.get_settings_bucket(self, default=default)
else:
return default
return default
class ThemableXBlockMixin(object):
......
......@@ -317,8 +317,7 @@ class StudioContainerXBlockMixin(object):
if root_xblock and root_xblock.location == self.location:
# User has clicked the "View" link. Show an editable preview of this block's children
return self.author_edit_view(context)
else:
return self.author_preview_view(context)
return self.author_preview_view(context)
def author_edit_view(self, context):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment