mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 14:36:03 -05:00
Fix more tempfile already open problems in Windows tests
This commit is contained in:
parent
176368a22b
commit
c6f1eb4766
@ -83,13 +83,13 @@ class TestShare(GuiBaseTest):
|
||||
),
|
||||
)
|
||||
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
with open(tmp_file.name, "wb") as f:
|
||||
f.write(r.content)
|
||||
tmp_file = tempfile.NamedTemporaryFile("wb", delete=False)
|
||||
tmp_file.write(r.content)
|
||||
tmp_file.close()
|
||||
|
||||
zip = zipfile.ZipFile(tmp_file.name)
|
||||
z = zipfile.ZipFile(tmp_file.name)
|
||||
QtTest.QTest.qWait(50)
|
||||
self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8"))
|
||||
self.assertEqual("onionshare", z.read("test.txt").decode("utf-8"))
|
||||
|
||||
QtTest.QTest.qWait(500)
|
||||
|
||||
@ -135,9 +135,8 @@ class TestShare(GuiBaseTest):
|
||||
),
|
||||
)
|
||||
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
with open(tmp_file.name, "wb") as f:
|
||||
f.write(r.content)
|
||||
tmp_file = tempfile.NamedTemporaryFile("wb")
|
||||
tmp_file.write(r.content)
|
||||
|
||||
with open(tmp_file.name, "r") as f:
|
||||
self.assertEqual("onionshare", f.read())
|
||||
@ -207,7 +206,10 @@ class TestShare(GuiBaseTest):
|
||||
QtTest.QTest.mouseRelease(
|
||||
tab.get_mode().server_status.server_button, QtCore.Qt.LeftButton
|
||||
)
|
||||
self.assertEqual(tab.get_mode().server_status.status, 0)
|
||||
self.assertEqual(
|
||||
tab.get_mode().server_status.status,
|
||||
tab.get_mode().server_status.STATUS_STOPPED,
|
||||
)
|
||||
self.server_is_stopped(tab)
|
||||
self.web_server_is_stopped(tab)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user