aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest-localserver/py3/patches/01-arcadia.patch
blob: d704d6362900072f3bd7e5939ded995219b2b281 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- contrib/python/pytest-localserver/py3/pytest_localserver/https.py	(index)
+++ contrib/python/pytest-localserver/py3/pytest_localserver/https.py	(working tree)
@@ -10,1 +10,1 @@ import os.path
-_ROOT = os.path.abspath(os.path.dirname(__file__))
+_ROOT = os.getcwd()
--- contrib/python/pytest-localserver/py3/pytest_localserver/plugin.py	(index)
+++ contrib/python/pytest-localserver/py3/pytest_localserver/plugin.py	(working tree)
@@ -4,6 +4,9 @@
 #
 # This program is release under the MIT license. You can find the full text of
 # the license in the LICENSE file.
+import os
+import pkgutil
+
 import pytest
 
 
@@ -62,11 +65,17 @@ def httpsserver(request):
     SSL encryption.
     """
     from pytest_localserver import https
-
-    server = https.SecureContentServer()
-    server.start()
-    request.addfinalizer(server.stop)
-    return server
+    try:
+        with open(https.DEFAULT_KEY, 'wb') as f:
+            f.write(pkgutil.get_data('pytest_localserver', 'server.key'))
+        with open(https.DEFAULT_CERTIFICATE, 'wb') as f:
+            f.write(pkgutil.get_data('pytest_localserver', 'cert.crt'))
+        server = https.SecureContentServer()
+        server.start()
+        request.addfinalizer(server.stop)
+        yield server
+    finally:
+        os.remove(https.DEFAULT_CERTIFICATE)
 
 
 @pytest.fixture