File: 0004-Use-the-same-python-binary-to-run-testimport.py.patch

package info (click to toggle)
beancount 2.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,976 kB
  • sloc: python: 42,325; ansic: 997; yacc: 737; lex: 424; javascript: 339; makefile: 209; xml: 32; sh: 4
file content (32 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download | duplicates (2)
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
From: Stefano Rivera <stefano@rivera.za.net>
Date: Fri, 16 Oct 2020 10:27:27 -0700
Subject: Use the same python binary to run testimport.py

Rather than relying on the shebang of testimport (which will load the
first python3 on PATH), use the same binary that the test suite is
running under.

On Debian, multiple versions of cPython can be installed concurrently
and this lets us test under a non-default version, e.g.:

$ python3.9 -m pytest beancount/

Bug-Debian: https://bugs.debian.org/972328
Forwarded: https://github.com/beancount/beancount/pull/565
---
 beancount/ingest/identify_test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/beancount/ingest/identify_test.py b/beancount/ingest/identify_test.py
index 17eba03..97ab94f 100644
--- a/beancount/ingest/identify_test.py
+++ b/beancount/ingest/identify_test.py
@@ -96,7 +96,7 @@ class TestScriptIdentify(scripts_utils.TestScriptsBase):
             env = os.environ.copy()
             env['PYTHONPATH'] = ':'.join(sys.path)
             output = subprocess.check_output(
-                [path.join(self.tempdir, 'testimport.py'),
+                [sys.executable, path.join(self.tempdir, 'testimport.py'),
                  '--downloads', path.join(self.tempdir, 'Downloads'),
                  'identify'], shell=False, env=env)
         self.assertTrue(re.match(regexp, output.decode().strip()))