diff --git a/.travis.yml b/.travis.yml index 8cddeec..ee84cc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: python python: - - "2.7" + - "3.5" install: - make requirements - pip install coveralls diff --git a/Makefile b/Makefile index 123bc96..0e2e1c9 100644 --- a/Makefile +++ b/Makefile @@ -13,4 +13,4 @@ requirements: pip install -r requirements.txt test: - coverage run -m nose + tox diff --git a/ccx_keys/tests/test_ccx_keys.py b/ccx_keys/tests/test_ccx_keys.py index 7f37712..cb5068b 100644 --- a/ccx_keys/tests/test_ccx_keys.py +++ b/ccx_keys/tests/test_ccx_keys.py @@ -1,6 +1,7 @@ """ Tests for the ccx_keys package. """ import ddt +import six from bson.objectid import ObjectId from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey, UsageKey @@ -260,8 +261,8 @@ class TestCCXBlockUsageLocator(LocatorBaseTest): "i4x://org.dept%sub-prof/course.num%section-4/category/name:12%33-44", ) def test_string_roundtrip(self, url): - actual = unicode(UsageKey.from_string(url)) - self.assertEquals( + actual = six.text_type(UsageKey.from_string(url)) + self.assertEqual( url, actual ) @@ -283,13 +284,13 @@ def test_missing_block_id(self, url): def test_valid_locations(self, org, course, run, ccx, category, name, revision): # pylint: disable=unused-argument course_key = CCXLocator(org=org, course=course, run=run, branch=revision, ccx=ccx) locator = CCXBlockUsageLocator(course_key, block_type=category, block_id=name, ) - self.assertEquals(org, locator.org) - self.assertEquals(course, locator.course) - self.assertEquals(run, locator.run) - self.assertEquals(ccx, locator.ccx) - self.assertEquals(category, locator.block_type) - self.assertEquals(name, locator.block_id) - self.assertEquals(revision, locator.branch) + self.assertEqual(org, locator.org) + self.assertEqual(course, locator.course) + self.assertEqual(run, locator.run) + self.assertEqual(ccx, locator.ccx) + self.assertEqual(category, locator.block_type) + self.assertEqual(name, locator.block_id) + self.assertEqual(revision, locator.branch) @ddt.data( (("foo",), {}), @@ -335,7 +336,7 @@ def test_invalid_locations(self, *args, **kwargs): def test_replacement(self, key, newvalue): course_key = CCXLocator(org='org', course='course', run='run', branch='rev', ccx='1', deprecated=False) kwargs = {key: newvalue} - self.assertEquals( + self.assertEqual( getattr(CCXBlockUsageLocator(course_key, 'c', 'n', deprecated=False).replace(**kwargs), key), newvalue ) @@ -350,7 +351,7 @@ def test_map_into_course_location(self): expected = CCXBlockUsageLocator(new_course, 'cat', 'name:more_name') actual = loc.map_into_course(new_course) - self.assertEquals(expected, actual) + self.assertEqual(expected, actual) def test_ccx_from_deprecated_string(self): """Verify that _from_deprecated_string raises NotImplemented""" diff --git a/setup.py b/setup.py index d1953f9..68b9358 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='edx-ccx-keys', - version='0.1.2', + version='0.2.0', author='edX', author_email='oscm@edx.org', description='Opaque key support custom courses on edX', @@ -16,12 +16,14 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', ], packages=[ 'ccx_keys', ], install_requires=[ - 'edx-opaque-keys>=0.2.1,<1.0.0', + 'edx-opaque-keys>=0.3.0,<1.0.0', + 'six>=1.10.0,<2.0.0' ], entry_points={ 'course_key': [ diff --git a/test-requirements.txt b/test-requirements.txt index 5ae5572..523ba82 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,4 @@ edx-lint>=0.4.0,<1.0.0 mock>=1.3.0,<2.0.0 nose>=1.3.7,<2.0.0 pep8>=1.7.0,<2.0.0 +tox>=2.3.1,<3.0.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a2d6a32 --- /dev/null +++ b/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py27,py35 + +[testenv] +deps = + -rtest-requirements.txt + +commands = + coverage run -m nose + coverage report -m