Skip to content

Commit

Permalink
Merge pull request #182 from edx/waheed/python-3-support
Browse files Browse the repository at this point in the history
PROD-388: Add python 3 support.
  • Loading branch information
waheedahmed committed Aug 30, 2019
2 parents 9e81f39 + ddc878a commit 96d0e3f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ matrix:
include:
- python: '2.7'
env: 'TOXENV=django111'
- python: '3.5'
env: 'TOXENV=django111'
- python: '3.6'
env: 'TOXENV=django20'
- python: '3.6'
Expand Down
2 changes: 1 addition & 1 deletion edxval/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def filename(self):
language=self.language_code,
format=self.file_format
).replace('\n', ' ')

return file_name

@classmethod
Expand Down
1 change: 1 addition & 0 deletions edxval/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Settings file for django app edxval.
"""
from __future__ import unicode_literals

DEBUG = True

Expand Down
4 changes: 2 additions & 2 deletions edxval/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def setUp(self):
"""
self.transcript_data = constants.VIDEO_TRANSCRIPT_CIELO24
super(VideoTranscriptTest, self).setUp()

def test_filename_property_new_line(self):
"""
Test that filename does not contain any "\n".
Test that filename does not contain any "\n".
New line is not permmited in response headers.
"""
video = Video.objects.create(**constants.VIDEO_DICT_NEW_LINE)
Expand Down
8 changes: 3 additions & 5 deletions edxval/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"""
from __future__ import absolute_import
import json
from six.moves.urllib.parse import urljoin
from six.moves.urllib.parse import urlencode

from ddt import data, ddt, unpack
from django.urls import reverse
Expand Down Expand Up @@ -449,7 +447,7 @@ def test_post_video_invalid_course_key(self):
url, constants.COMPLETE_SET_WITH_SOME_INVALID_COURSE_KEY, format='json'
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
response = json.loads(response.content)
response = json.loads(response.content.decode('utf-8'))
# Check that invalid course keys have been filtered out.
self.assertEqual(response['courses'], [{u'edX/DemoX/Astonomy': None}])

Expand Down Expand Up @@ -1007,7 +1005,7 @@ def test_videos_list_missing_hls_encodes(self, batch_size, offset):
"""
expected_video_ids = ['video-wo-hls1', 'video-wo-hls2']
response = self.client.post(self.url, {'batch_size': batch_size, 'offset': offset}, format='json')
response = json.loads(response.content)
response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response['videos'], expected_video_ids[offset: offset+batch_size])

def test_videos_list_missing_hls_encodes_for_courses(self):
Expand All @@ -1018,7 +1016,7 @@ def test_videos_list_missing_hls_encodes_for_courses(self):
response = self.client.post(self.url, {
'courses': ['test-course-1', 'test-course-2']
}, format='json')
response = json.loads(response.content)
response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response['videos'], expected_video_ids)

def test_update_hls_encodes_for_video(self):
Expand Down
15 changes: 12 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import absolute_import, print_function
import os
import sys

Expand Down Expand Up @@ -61,11 +60,21 @@ def load_requirements(*requirements_paths):
description='edx-val',
license='AGPL',
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
],
packages=PACKAGES,
install_requires=load_requirements('requirements/base.in'),
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27-django111,py{36,37}-django{111,20,21}
envlist = py{27,35}-django111,py{36,37}-django{111,20,21}

[testenv]
deps =
Expand Down
1 change: 0 additions & 1 deletion urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import absolute_import
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin

Expand Down

0 comments on commit 96d0e3f

Please sign in to comment.