Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- 2.7
install:
- pip install -e .
- pip install coveralls
script:
- python setup.py test --coverage --pep8 --flakes
- coverage run --source=pylmod setup.py test
after_success:
coveralls
17 changes: 16 additions & 1 deletion pylmod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@
"""
PyLmod is a module that implements MIT Learning Modules API in python
"""
import os.path
from pkg_resources import get_distribution, DistributionNotFound

from pylmod.client import Client
from pylmod.stellargradebook import StellarGradeBook
VERSION = "0.1.0" # pragma: no cover

try:
_dist = get_distribution('pylmod')
# Normalize case for Windows systems
dist_loc = os.path.normcase(_dist.location)
here = os.path.normcase(__file__)
if not here.startswith(os.path.join(dist_loc, 'pylmod')):
# not installed, but there is another version that *is*
raise DistributionNotFound
except DistributionNotFound:
__version__ = 'Please install this project with setup.py'
else:
__version__ = _dist.version


__all__ = ['Client', 'StellarGradeBook', ]
Empty file added pylmod/tests/__init__.py
Empty file.
28 changes: 28 additions & 0 deletions pylmod/tests/test_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
Testing of the module level stuff itself
"""
import unittest

import semantic_version


class TestModule(unittest.TestCase):
"""
Test core module features, like asserting the version
and making sure we are exposing our classes
"""

def test_version(self):
"""
Verify we have a valid semantic version
"""
import pylmod
semantic_version.Version(pylmod.__version__)

def test_client_classes(self):
"""
Assert that Client is available from the base module
"""
import pylmod
self.assertTrue('Client' in dir(pylmod))
28 changes: 12 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

import sys

from setuptools import setup
from setuptools import setup, find_packages
from setuptools.command.test import test as testcommand

with open('test_requirements.txt') as test_reqs:
tests_require = test_reqs.readlines(),


class PyTest(testcommand):
user_options = testcommand.user_options[:]
Expand Down Expand Up @@ -47,35 +50,28 @@ def run_tests(self):
sys.exit(errno)


extra = dict(test_suite="pylmod.tests",
tests_require=["pytest-cov>=1.8.0", "pytest-pep8>=1.0.6",
"pytest-flakes>=0.2", "pytest>=2.6.3",
"pyflakes>=0.8.1", "pytest-cache>=1.0",
"httpretty>=0.8.3", "semantic_version>=2.3.1",
],
cmdclass={"test": PyTest},
install_requires=["requests>=2.5.1", ],
include_package_data=True,
zip_safe=True)

VERSION = __import__('pylmod').VERSION

README = open('README.rst').read()

setup(
name='pylmod',
version=VERSION,
version='0.1.0',
license='BSD',
author='MIT ODL Engineering',
author_email='odl-engineering@mit.edu',
url="http://github.com/mitodl/pylmod",
description="PyLmod is a Python Implementation of MIT Learning Modules",
long_description=README,
packages=find_packages(),
install_requires=["requests>=2.5.1", ],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Programming Language :: Python',
],
**extra
test_suite="pylmod.tests",
tests_require=tests_require,
cmdclass={"test": PyTest},
include_package_data=True,
zip_safe=True,
)
8 changes: 8 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pytest-cov>=1.8.0
pytest-pep8>=1.0.6,
pytest-flakes>=0.2,
pytest>=2.6.3,
pyflakes>=0.8.1,
pytest-cache>=1.0,
httpretty>=0.8.3,
semantic_version>=2.3.1