Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from open-craft/initial-implementation
Browse files Browse the repository at this point in the history
Initial implementation
  • Loading branch information
itsjeyd committed Dec 10, 2015
2 parents 4fdb02a + 461371b commit ded76fc
Show file tree
Hide file tree
Showing 26 changed files with 4,704 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__/
*.py[cod]
tests.integration.*.log
tests.integration.*.png
vectordraw_xblock.egg-info/
var/
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: python
python:
- 2.7
before_install:
- export DISPLAY=:99
- sh -e /etc/init.d/xvfb start
install:
- pip install -r test-requirements.txt
- 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 $VIRTUAL_ENV/src/xblock/requirements.txt
script:
- pep8 --max-line-length=100 vectordraw
- pylint vectordraw
- ./run_tests.py --with-coverage --cover-package=vectordraw
notifications:
email: false
addons:
firefox: 36.0
19 changes: 19 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[REPORTS]
reports=no

[FORMAT]
max-line-length=100

[MESSAGES CONTROL]
disable=
I,
attribute-defined-outside-init,
maybe-no-member,
star-args,
too-few-public-methods,
too-many-ancestors,
too-many-instance-attributes,
too-many-public-methods

[VARIABLES]
dummy-variables-rgx=_$|dummy|unused
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git+https://github.com/edx/[email protected]#egg=XBlock
git+https://github.com/edx/xblock-utils.git@b4f9b51146c7fafa12f41d54af752b8f1516dffd#egg=xblock-utils
-e .
52 changes: 52 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Run tests for the Vector Drawing XBlock.
This script is required to run our selenium tests inside the xblock-sdk workbench
because the workbench SDK's settings file is not inside any python module.
"""

import os
import logging
import sys

from django.conf import settings
from django.core.management import execute_from_command_line

logging_level_overrides = {
'workbench.views': logging.ERROR,
'django.request': logging.ERROR,
'workbench.runtime': logging.ERROR,
}

if __name__ == '__main__':
# Use the workbench settings file:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'workbench.settings')
# Configure a range of ports in case the default port of 8081 is in use
os.environ.setdefault('DJANGO_LIVE_TEST_SERVER_ADDRESS', 'localhost:8081-8099')

try:
os.mkdir('var')
except OSError:
# May already exist.
pass

settings.INSTALLED_APPS += ('vectordraw', )

for noisy_logger, log_level in logging_level_overrides.iteritems():
logging.getLogger(noisy_logger).setLevel(log_level)

args_iter = iter(sys.argv[1:])
options = []
paths = []
for arg in args_iter:
if arg == '--':
break
if arg.startswith('-'):
options.append(arg)
else:
paths.append(arg)
paths.extend(args_iter)
if not paths:
paths = ['tests/']
execute_from_command_line([sys.argv[0], 'test'] + options + ['--'] + paths)
40 changes: 40 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Setup for vectordraw XBlock."""

import os
from setuptools import setup


def package_data(pkg, roots):
"""Generic function to find package_data.
All of the files under each of the `roots` will be declared as package
data for package `pkg`.
"""
data = []
for root in roots:
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))

return {pkg: data}


setup(
name='vectordraw-xblock',
version='0.1',
description='vectordraw XBlock', # TODO: write a better description.
packages=[
'vectordraw',
],
install_requires=[
'XBlock',
'xblock-utils',
],
entry_points={
'xblock.v1': [
'vectordraw = vectordraw:VectorDrawXBlock',
]
},
package_data=package_data("vectordraw", ["static", "public"]),
)
5 changes: 5 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Django>=1.8, <1.9
-r requirements.txt
-e git+https://github.com/edx/xblock-sdk.git@8eb5f174dc59c0f4e40e10eaab56753958651d17#egg=xblock-sdk
ddt
selenium==2.47.3 # 2.48 is not working atm
Empty file added tests/__init__.py
Empty file.
Empty file added tests/integration/__init__.py
Empty file.
Loading

0 comments on commit ded76fc

Please sign in to comment.