This is an automated email from the ASF dual-hosted git repository. brondsem pushed a commit to branch db/8375 in repository https://gitbox.apache.org/repos/asf/allura.git
commit 8a17b6fffe6e4359fdf4a9019217dbd268bb60ae Author: Dave Brondsema <d...@brondsema.net> AuthorDate: Mon Aug 24 17:53:38 2020 -0400 [#8375] for json dumping to temp files, set mode to not binary --- ForgeBlog/forgeblog/tests/test_app.py | 4 ++-- ForgeDiscussion/forgediscussion/tests/test_app.py | 4 ++-- ForgeLink/forgelink/tests/test_app.py | 2 +- ForgeTracker/forgetracker/tests/test_app.py | 4 ++-- ForgeWiki/forgewiki/tests/test_app.py | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ForgeBlog/forgeblog/tests/test_app.py b/ForgeBlog/forgeblog/tests/test_app.py index 26089b9..8c92ec0 100644 --- a/ForgeBlog/forgeblog/tests/test_app.py +++ b/ForgeBlog/forgeblog/tests/test_app.py @@ -82,7 +82,7 @@ class TestBulkExport(object): post2.make_slug() post2.commit() - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') blog.bulk_export(f) f.seek(0) blog = json.loads(f.read()) @@ -116,7 +116,7 @@ class TestBulkExport(object): p = post.discussion_thread.add_post(text='test comment') p.add_multiple_attachments(test_file1) ThreadLocalORMSession.flush_all() - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') temp_dir = tempfile.mkdtemp() blog.bulk_export(f, temp_dir, True) f.seek(0) diff --git a/ForgeDiscussion/forgediscussion/tests/test_app.py b/ForgeDiscussion/forgediscussion/tests/test_app.py index 30f9d90..9495b6f 100644 --- a/ForgeDiscussion/forgediscussion/tests/test_app.py +++ b/ForgeDiscussion/forgediscussion/tests/test_app.py @@ -64,7 +64,7 @@ class TestBulkExport(TestDiscussionApiBase): project = M.Project.query.get(shortname='test') discussion = project.app_instance('discussion') - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') discussion.bulk_export(f) f.seek(0) discussion = json.loads(f.read()) @@ -100,7 +100,7 @@ class TestBulkExport(TestDiscussionApiBase): post.add_attachment(test_file1) ThreadLocalORMSession.flush_all() - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') temp_dir = tempfile.mkdtemp() discussion.bulk_export(f, temp_dir, True) f.seek(0) diff --git a/ForgeLink/forgelink/tests/test_app.py b/ForgeLink/forgelink/tests/test_app.py index 310a4d2..1055f81 100644 --- a/ForgeLink/forgelink/tests/test_app.py +++ b/ForgeLink/forgelink/tests/test_app.py @@ -42,7 +42,7 @@ class TestBulkExport(object): project = M.Project.query.get(shortname='test') link = project.app_instance('link') link.config.options['url'] = 'http://domain.net' - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') link.bulk_export(f) f.seek(0) assert_equal(json.loads(f.read())['url'], 'http://domain.net') diff --git a/ForgeTracker/forgetracker/tests/test_app.py b/ForgeTracker/forgetracker/tests/test_app.py index 5053990..72c64cd 100644 --- a/ForgeTracker/forgetracker/tests/test_app.py +++ b/ForgeTracker/forgetracker/tests/test_app.py @@ -111,7 +111,7 @@ class TestBulkExport(TrackerTestController): # Besides, core functionality shouldn't need the c context vars c.app = c.project = None - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') self.tracker.bulk_export(f) f.seek(0) tracker = json.loads(f.read()) @@ -141,7 +141,7 @@ class TestBulkExport(TrackerTestController): def test_export_with_attachments(self): - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') temp_dir = tempfile.mkdtemp() self.tracker.bulk_export(f, temp_dir, True) f.seek(0) diff --git a/ForgeWiki/forgewiki/tests/test_app.py b/ForgeWiki/forgewiki/tests/test_app.py index d7f80e8..66b11b9 100644 --- a/ForgeWiki/forgewiki/tests/test_app.py +++ b/ForgeWiki/forgewiki/tests/test_app.py @@ -69,7 +69,7 @@ class TestBulkExport(object): # Besides, it's better not to need c context vars c.app = c.project = None - f = tempfile.TemporaryFile() + f = tempfile.TemporaryFile('w+') self.wiki.bulk_export(f) f.seek(0) wiki = json.loads(f.read()) @@ -102,7 +102,7 @@ class TestBulkExport(object): def test_bulk_export_with_attachmetns(self): self.add_page_with_attachmetns() temp_dir = tempfile.mkdtemp() - f = tempfile.TemporaryFile(dir=temp_dir) + f = tempfile.TemporaryFile('w+', dir=temp_dir) self.wiki.bulk_export(f, temp_dir, True) f.seek(0) wiki = json.loads(f.read()) @@ -116,7 +116,7 @@ class TestBulkExport(object): def test_bulk_export_without_attachments(self): self.add_page_with_attachmetns() temp_dir = tempfile.mkdtemp() - f = tempfile.TemporaryFile(dir=temp_dir) + f = tempfile.TemporaryFile('w+', dir=temp_dir) self.wiki.bulk_export(f, temp_dir) f.seek(0) wiki = json.loads(f.read())