fine, just skip tests on windows

This commit is contained in:
meejah 2021-12-01 20:52:22 -07:00
parent 940c6343cf
commit e0092ededa

View File

@ -19,6 +19,7 @@ import time
import os.path import os.path
import re import re
import json import json
from unittest import skipIf
from six.moves import StringIO from six.moves import StringIO
from twisted.trial import unittest from twisted.trial import unittest
@ -1153,6 +1154,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin):
d.addBoth(_cleanup) d.addBoth(_cleanup)
return d return d
@skipIf(platform.isWindows())
def test_deserialize_pickle(self): def test_deserialize_pickle(self):
""" """
The crawler can read existing state from the old pickle format The crawler can read existing state from the old pickle format
@ -1163,12 +1165,8 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin):
storage = root.child("storage") storage = root.child("storage")
storage.makedirs() storage.makedirs()
test_pickle = storage.child("lease_checker.state") test_pickle = storage.child("lease_checker.state")
with test_pickle.open("w") as local, original_pickle.open("r") as remote: with test_pickle.open("wb") as local, original_pickle.open("rb") as remote:
for line in remote.readlines(): test_pickle.write(original_pickle.read())
if platform.isWindows():
local.write(line.replace("\n", "\r\n"))
else:
local.write(line)
# convert from pickle format to JSON # convert from pickle format to JSON
top = Options() top = Options()
@ -1358,6 +1356,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin):
second_serial.load(), second_serial.load(),
) )
@skipIf(platform.isWindows())
def test_deserialize_history_pickle(self): def test_deserialize_history_pickle(self):
""" """
The crawler can read existing history state from the old pickle The crawler can read existing history state from the old pickle
@ -1369,12 +1368,8 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin):
storage = root.child("storage") storage = root.child("storage")
storage.makedirs() storage.makedirs()
test_pickle = storage.child("lease_checker.history") test_pickle = storage.child("lease_checker.history")
with test_pickle.open("w") as local, original_pickle.open("r") as remote: with test_pickle.open("wb") as local, original_pickle.open("rb") as remote:
for line in remote.readlines(): test_pickle.write(original_pickle.read())
if platform.isWindows():
local.write(line.replace("\n", "\r\n"))
else:
local.write(line)
# convert from pickle format to JSON # convert from pickle format to JSON
top = Options() top = Options()