From 25ca767095019f3f0d6288b2a870ef3b98eef112 Mon Sep 17 00:00:00 2001 From: meejah Date: Wed, 1 Dec 2021 11:49:52 -0700 Subject: [PATCH] an offering to the windows godesses --- src/allmydata/test/test_storage_web.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/allmydata/test/test_storage_web.py b/src/allmydata/test/test_storage_web.py index dff3b36f5..282fb67e1 100644 --- a/src/allmydata/test/test_storage_web.py +++ b/src/allmydata/test/test_storage_web.py @@ -22,11 +22,11 @@ import json from six.moves import StringIO from twisted.trial import unittest - from twisted.internet import defer from twisted.application import service from twisted.web.template import flattenString from twisted.python.filepath import FilePath +from twisted.python.runtime import platform from foolscap.api import fireEventually from allmydata.util import fileutil, hashutil, base32, pollmixin @@ -1163,8 +1163,12 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin): storage = root.child("storage") storage.makedirs() test_pickle = storage.child("lease_checker.state") - with test_pickle.open("wb") as local, original_pickle.open("rb") as remote: - local.write(remote.read()) + with test_pickle.open("w") as local, original_pickle.open("r") as remote: + for line in remote.readlines(): + if platform.isWindows(): + local.write(line.replace("\n", "\r\n")) + else: + local.write(line.replace("\n", "\r\n")) # convert from pickle format to JSON top = Options() @@ -1366,7 +1370,11 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin): storage.makedirs() test_pickle = storage.child("lease_checker.history") with test_pickle.open("wb") as local, original_pickle.open("rb") as remote: - local.write(remote.read()) + for line in remote.readlines(): + if platform.isWindows(): + local.write(line.replace("\n", "\r\n")) + else: + local.write(line) # convert from pickle format to JSON top = Options()