From ec894ee10c1dec0906fdfa28c268ec20c9379eef Mon Sep 17 00:00:00 2001 From: aarif Date: Tue, 3 Sep 2019 14:18:33 +0500 Subject: [PATCH] python 3 fixes fixed test failures fixed test failures python 3 fixes fixed test failures fixed test failures changes made as suggested minor change --- common/djangoapps/util/file.py | 2 +- lms/djangoapps/instructor/tests/test_api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/util/file.py b/common/djangoapps/util/file.py index 53e6b7cae0..4646ee07a2 100644 --- a/common/djangoapps/util/file.py +++ b/common/djangoapps/util/file.py @@ -168,7 +168,7 @@ class UniversalNewlineIterator(object): line = char yield self.sanitize(last_line) else: - line += char + line += six.text_type(char) if isinstance(char, int) else char buf = self.original_file.read(self.buffer_size) if not buf and line: yield self.sanitize(line) diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 0724566661..f226be79ee 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -5255,7 +5255,7 @@ class TestBulkCohorting(SharedModuleStoreTestCase): # this temporary file will be removed in `self.tearDown()` __, file_name = tempfile.mkstemp(suffix=suffix, dir=self.tempdir) with open(file_name, 'w') as file_pointer: - file_pointer.write(csv_data.encode('utf-8')) + file_pointer.write(csv_data) with open(file_name, 'r') as file_pointer: url = reverse('add_users_to_cohorts', kwargs={'course_id': text_type(self.course.id)}) return self.client.post(url, {'uploaded-file': file_pointer})