summaryrefslogtreecommitdiff
path: root/dev-python/sh/files/sh-1.14.0-fix-sleep-test.patch
blob: 28d1ec9847fdc97c7a9c3386d786a864c88e8a57 (plain)
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
From 83b189de4f461ed0370b0472f1938d3162ed00c7 Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Tue, 1 Sep 2020 23:18:13 +0200
Subject: [PATCH] Remove hardcoded path for sleep executable

test.py:
In test_timeout the path for the sleep executable has been hardcoded to
be /bin/sleep. However, on operating systems such as Arch Linux, Fedora
or Solaris the executable resides in /usr/bin/sleep due to a /usr merge
(e.g. see
  https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/).
By only checking for the name of the executable and its parameter the
test becomes more generic and thus can run on any (Unix-like) operating
system (given that `sleep` is in PATH).

Fixes #539
---
 test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test.py b/test.py
index f8029c04..142fcc0d 100644
--- a/test.py
+++ b/test.py
@@ -2014,7 +2014,7 @@ def test_timeout(self):
         try:
             sh.sleep(sleep_for, _timeout=timeout).wait()
         except sh.TimeoutException as e:
-            self.assertEqual(e.full_cmd, '/bin/sleep 3')
+            assert 'sleep 3' in e.full_cmd
         else:
             self.fail("no timeout exception")
         elapsed = time() - started