aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2020-08-21 18:33:45 -0400
committerMicah Lee <micah@micahflee.com>2020-08-21 18:33:45 -0400
commitc6f1eb4766296e7dd98c9d3b466afab099dd27d8 (patch)
tree0820f8a92804977ec54de7473ada12a6ec177e2f /tests
parent176368a22b89cd83dc11bfefe7baa80dcfdd7bec (diff)
downloadonionshare-c6f1eb4766296e7dd98c9d3b466afab099dd27d8.tar.gz
onionshare-c6f1eb4766296e7dd98c9d3b466afab099dd27d8.zip
Fix more tempfile already open problems in Windows tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gui_share.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/test_gui_share.py b/tests/test_gui_share.py
index 846a5034..58c90977 100644
--- a/tests/test_gui_share.py
+++ b/tests/test_gui_share.py
@@ -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)