File: upstream_tests-test_ids-fix-relative-path.patch

package info (click to toggle)
osinfo-db 0.20221130-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,780 kB
  • sloc: python: 1,672; sh: 344; makefile: 89
file content (35 lines) | stat: -rw-r--r-- 1,149 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
From 2d938b0e3656d7177a0bdbf7c94a9e4761eac98c Mon Sep 17 00:00:00 2001
From: Victor Toso <victortoso@redhat.com>
Date: Thu, 1 Dec 2022 21:22:51 +0100
Subject: [PATCH] tests/test_ids: fix relative path

Running test_ids.py outside git tree is currently broken due the
hardcoded "data" directory into relative path.

This was introduced in d95a0c22 when converting test to use pathlib
module.

We should use INTERNAL_OSINFO_DB_DATA_DIR environment variable
instead, provided by util.DataFiles.datadir.

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 tests/test_ids.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_ids.py b/tests/test_ids.py
index ff521d98..86150a49 100644
--- a/tests/test_ids.py
+++ b/tests/test_ids.py
@@ -13,7 +13,7 @@ def _test_validate_ids(xml, entity_type):
     This check tries to mimic, in a pythonic way, the very same
     check done by OsinfoLoader::osinfo_loader_check_id()
     """
-    base = Path("data", entity_type)
+    base = Path(util.DataFiles.datadir, entity_type)
     relpath = xml.path.relative_to(base)
 
     suffix = xml.internal_id[len("http://") :]
-- 
2.35.1