File: 0006-Configure-test-harness-for-Debian-build-environment.patch

package info (click to toggle)
matrix-synapse 1.136.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,244 kB
  • sloc: python: 255,664; javascript: 7,252; sql: 4,727; sh: 1,158; perl: 626; makefile: 157
file content (41 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download
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
41
From: Antonio Russo <aerusso@aerusso.net>
Date: Fri, 22 Sep 2023 05:51:33 -0600
Subject: Configure test harness for Debian build environment

Forwarded: not-needed

The test harness relies on an import from the current directory, but also
dumps temporary test files into that directory.  Additionally, the tests
respond to the proxy settings, causing local lookups to fail.

To fix this,
 - Unset the proxy (as of this writing, the tests work with the network
   disabled).
 - Add the cwd to sys.path
 - cd to a temporary location suitable for storing temporary test files
---
 tests/__init__.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/__init__.py b/tests/__init__.py
index 4c8633b..c673a45 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -20,6 +20,17 @@
 #
 
 from twisted.trial import util
+import os, sys
+import os.path
+os.environ.pop('no_proxy', '')
+os.environ.pop('http_proxy', '')
+os.environ.pop('https_proxy', '')
+sys.path.append(os.getcwd())
+# Under dh 13, HOME is set to a temporary directory
+tempdir = os.path.join(os.environ['HOME'], "synapse-tests-tempdir")
+os.makedirs(tempdir)
+os.chdir(tempdir)
+
 
 from synapse.util.patch_inline_callbacks import do_patch