From 83b189de4f461ed0370b0472f1938d3162ed00c7 Mon Sep 17 00:00:00 2001 From: David Runge 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