Skip to content

Commit

Permalink
Merge pull request openedx#1023 from edx/efischer/tox
Browse files Browse the repository at this point in the history
Tox, for parallel test goodness
  • Loading branch information
Eric Fischer authored Aug 2, 2017
2 parents 43aa53e + 3e13d27 commit 60f6ea3
Show file tree
Hide file tree
Showing 188 changed files with 842 additions and 8,007 deletions.
44 changes: 16 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
addons:
apt:
packages:
- aspell
- aspell-en
- g++
- gcc
- git
- gfortran
- libblas3gf
- libblas-dev
- liblapack3gf
- liblapack-dev
- libatlas-base-dev
- libfontconfig1
- libmysqlclient-dev
- libxml2-dev
- libxslt1-dev
- nodejs
- python2.7
- python2.7-dev
- python-pip
- python-software-properties
language: python
sudo: false
python:
- "2.7"
env:
- TOXENV=django18
- TOXENV=django111
matrix:
include:
- python: 2.7
env: TOXENV=quality
- python: 2.7
env: TOXENV=js
before_install:
- "pip install -U pip"
cache:
directories:
- $HOME/.cache/pip
install:
- "pip install coveralls"
- "make install"
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "pip install tox"
script:
- "make verify-generated-files"
- "make test"
- "python manage.py makemessages -l eo"
- tox
branches:
only:
- master
- ora-staff-grading
after_success:
coveralls
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include LICENSE
include AUTHORS
include README.rst
include setup.cfg
include openassessment/xblock/static/css/*.css
include openassessment/xblock/static/css/lib/backgrid/*.css
include openassessment/xblock/static/js/openassessment*.min.js
include openassessment/xblock/static/js/lib/backgrid/*.js
include requirements/*.txt
recursive-include openassessment/xblock/static/js/src *.js
recursive-include openassessment/templates *.html *.underscore
recursive-include openassessment/locale *.po
recursive-include openassessment/locale *.mo
global-exclude */test*
global-exclude */test?/*
62 changes: 23 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
all: install test

.PHONY: install test

# not used by travis
install-system:
sudo apt-get update -qq
sudo xargs -a apt-packages.txt apt-get install -qq --fix-missing

# not used by travis
install-node:
sudo apt-get install -qq nodejs

install-wheels:
./scripts/install-wheels.sh


##################
# Install commands
##################
install-python:
./scripts/install-python.sh
pip install -r requirements/django.txt
pip install -r requirements/base.txt --only-binary=lxml,libsass

install-js:
npm install

install-nltk-data:
./scripts/download-nltk-data.sh
install-test:
pip install -r requirements/test.txt

install: install-python install-js install-test javascript sass

##############################
# Generate js/css output files
##############################
STATIC_JS = openassessment/xblock/static/js
STATIC_CSS = openassessment/xblock/static/css

update-npm-requirements:
npm update --silent
cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/

javascript: update-npm-requirements
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/lms/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-lms.min.js"
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/studio/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-studio.min.js"
Expand All @@ -38,27 +34,17 @@ sass:
verify-generated-files:
@git diff --quiet || (echo 'Modifications exist locally! Run `make javascript` or `make sass` to update bundled files.'; exit 1)

install-test:
pip install -q -r requirements/test.txt

install-sys-requirements: install-system install-node
npm config set loglevel warn

install-dev:
pip install -q -r requirements/dev.txt

install: install-wheels install-python install-js install-nltk-data install-test install-dev javascript sass

################
#Tests and checks
################
quality:
./node_modules/.bin/jshint $(STATIC_JS)/src -c .jshintrc --verbose
./node_modules/jscs/bin/jscs $(STATIC_JS)/src --verbose
./scripts/run-pep8.sh
./scripts/run-pylint.sh

test: quality test-python test-js

test-python:
./scripts/test-python.sh
coverage run manage.py test openassessment

render-templates:
./scripts/render-templates.sh
Expand All @@ -69,15 +55,13 @@ test-js: render-templates
test-js-debug: render-templates
./scripts/js-debugger.sh

test-sandbox: test-acceptance test-a11y
test: quality test-python test-js

# acceptance and a11y tests require a functioning sandbox, and do not run on travis
test-acceptance:
./scripts/test-acceptance.sh tests

test-a11y:
./scripts/test-acceptance.sh accessibility

update-npm-requirements:
npm update --silent
cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/
test-sandbox: test-acceptance test-a11y
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Open Response Assessment |build-status| |coverage-status|
Installation, Tests, and other Developer Tasks
==============================================

EdX engineers follow the `guides on our wiki <https://openedx.atlassian.net/wiki/display/EDUCATOR/ORA+FAQ>`_.
EdX engineers follow the `guides on our wiki <https://openedx.atlassian.net/wiki/spaces/EDUCATOR/pages/9765004/ORA+Developer+Guide>`_.

License
=======
Expand Down
20 changes: 0 additions & 20 deletions apt-packages.txt

This file was deleted.

1 change: 0 additions & 1 deletion conf/locale

This file was deleted.

7 changes: 0 additions & 7 deletions logs/README.txt

This file was deleted.

2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys
import os
import sys

if __name__ == "__main__":

Expand Down
48 changes: 4 additions & 44 deletions openassessment/assessment/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import json

from django.contrib import admin
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils import html

from openassessment.assessment.models import (
Assessment, AssessmentFeedback, PeerWorkflow, PeerWorkflowItem, Rubric,
AIGradingWorkflow, AITrainingWorkflow, AIClassifierSet, AIClassifier
)
from openassessment.assessment.models import Assessment, AssessmentFeedback, PeerWorkflow, PeerWorkflowItem, Rubric
from openassessment.assessment.serializers import RubricSerializer


Expand Down Expand Up @@ -92,7 +89,7 @@ def rubric_link(self, assessment_obj):
"""
Returns the rubric link for this assessment.
"""
url = reverse(
url = reverse_lazy(
'admin:assessment_rubric_change',
args=[assessment_obj.rubric.id]
)
Expand Down Expand Up @@ -141,7 +138,7 @@ def assessments_by(self, assessment_feedback):
"""
links = [
u'<a href="{}">{}</a>'.format(
reverse('admin:assessment_assessment_change', args=[asmt.id]),
reverse_lazy('admin:assessment_assessment_change', args=[asmt.id]),
html.escape(asmt.scorer_id)
)
for asmt in assessment_feedback.assessments.all()
Expand All @@ -150,44 +147,7 @@ def assessments_by(self, assessment_feedback):
assessments_by.allow_tags = True


class AIGradingWorkflowAdmin(admin.ModelAdmin):
"""
Django admin model for AIGradingWorkflows.
"""
list_display = ('uuid', 'submission_uuid')
search_fields = ('uuid', 'submission_uuid', 'student_id', 'item_id', 'course_id')
readonly_fields = ('uuid', 'submission_uuid', 'student_id', 'item_id', 'course_id')


class AITrainingWorkflowAdmin(admin.ModelAdmin):
"""
Django admin model for AITrainingWorkflows.
"""
list_display = ('uuid',)
search_fields = ('uuid', 'course_id', 'item_id',)
readonly_fields = ('uuid', 'course_id', 'item_id',)


class AIClassifierInline(admin.TabularInline):
"""
Django admin model for AIClassifiers.
"""
model = AIClassifier


class AIClassifierSetAdmin(admin.ModelAdmin):
"""
Django admin model for AICLassifierSets.
"""
list_display = ('id',)
search_fields = ('id',)
inlines = [AIClassifierInline]


admin.site.register(Rubric, RubricAdmin)
admin.site.register(PeerWorkflow, PeerWorkflowAdmin)
admin.site.register(Assessment, AssessmentAdmin)
admin.site.register(AssessmentFeedback, AssessmentFeedbackAdmin)
admin.site.register(AIGradingWorkflow, AIGradingWorkflowAdmin)
admin.site.register(AITrainingWorkflow, AITrainingWorkflowAdmin)
admin.site.register(AIClassifierSet, AIClassifierSetAdmin)
Loading

0 comments on commit 60f6ea3

Please sign in to comment.