File: 0003-Use-pristine-home-directory-for-Python-tests.patch

package info (click to toggle)
ros2-colcon-core 0.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,156 kB
  • sloc: python: 10,333; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 968 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
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Wed, 18 Oct 2023 11:58:46 +0200
Subject: Use pristine home directory for Python tests

---
 test/test_build_python.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/test_build_python.py b/test/test_build_python.py
index 7780a56..89092b8 100644
--- a/test/test_build_python.py
+++ b/test/test_build_python.py
@@ -3,6 +3,7 @@
 
 import asyncio
 from contextlib import suppress
+import os
 from pathlib import Path
 from tempfile import TemporaryDirectory
 from types import SimpleNamespace
@@ -58,6 +59,9 @@ def _test_build_package(
     asyncio.set_event_loop(event_loop)
     try:
         tmp_path = Path(tmp_path_str)
+        home_path = tmp_path / "fake_home"
+        home_path.mkdir(exist_ok=True)
+        os.environ["HOME"] = str(home_path)
         python_build_task = PythonBuildTask()
         package = PackageDescriptor(tmp_path / 'src')
         package.name = 'test-package'