tests: fix discovery of location

backport upstream commit d93e1563add8c40450556b7d74520439ee792bd9
This commit is contained in:
Pino Toscano 2020-04-02 12:00:47 +02:00
parent 35d5f6a551
commit 33606eba22
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From d93e1563add8c40450556b7d74520439ee792bd9 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Fri, 12 Oct 2018 12:50:18 +0200
Subject: [PATCH] test: fix discovery of location
Use __file__ to detect the location of the script instead of sys.argv,
so it will work also when loaded as module.
---
test/test_augeas.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_augeas.py b/test/test_augeas.py
index 10edbe6..7474841 100644
--- a/test/test_augeas.py
+++ b/test/test_augeas.py
@@ -4,7 +4,7 @@ import unittest
import sys
import os
-__mydir = os.path.dirname(sys.argv[0])
+__mydir = os.path.dirname(os.path.abspath(__file__))
if not os.path.isdir(__mydir):
__mydir = os.getcwd()
--
2.21.0

View File

@ -1,10 +1,11 @@
Name: python-augeas
Version: 0.5.0
Release: 19%{?dist}
Release: 20%{?dist}
Summary: Python bindings to augeas
License: LGPLv2+
URL: http://augeas.net/
Source0: http://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
Patch1: 0001-test-fix-discovery-of-location.patch
BuildArch: noarch
BuildRequires: python3-setuptools
@ -25,6 +26,7 @@ python3-augeas is a set of Python bindings around augeas.
%prep
%setup -q
%patch1 -p1
%build
%{py3_build}
@ -41,6 +43,10 @@ python3-augeas is a set of Python bindings around augeas.
%changelog
* Thu Apr 02 2020 Pino Toscano <ptoscano@redhat.com> - 0.5.0-20
- Backport upstream commit d93e1563add8c40450556b7d74520439ee792bd9 to fix
the discovery of location in the test
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild