[Git][reproducible-builds/diffoscope][master] tests/test_tools: fix test if /sbin contains a directory

Mattia Rizzolo gitlab at salsa.debian.org
Sun Jul 8 11:13:58 CEST 2018


Mattia Rizzolo pushed to branch master at Reproducible Builds / diffoscope


Commits:
8c2b0797 by Mattia Rizzolo at 2018-07-08T11:11:49+02:00
tests/test_tools: fix test if /sbin contains a directory

The test_sbin_added_to_path test would then fail with an unhelpful
message (diffoscope.exc.RequiredToolNotFound: name_of_the_subdir) if
/sbin contains a subdirectory and os.listdir() returned it as the first
member.

Fixes: MR: !2
Thanks: Chris Lamb <lamby at debian.org> for the patch
Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- tests/test_tools.py


Changes:

=====================================
tests/test_tools.py
=====================================
--- a/tests/test_tools.py
+++ b/tests/test_tools.py
@@ -24,7 +24,9 @@ import pytest
 def test_sbin_added_to_path():
     from diffoscope.tools import tool_required
 
-    @tool_required(os.listdir('/sbin')[0])
+    _, _, filenames = list(os.walk('/sbin'))[0]
+
+    @tool_required(filenames[0])
     def fn():
         pass
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/8c2b0797155665a628b6c383b75435799de4c7ca

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/8c2b0797155665a628b6c383b75435799de4c7ca
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20180708/06f66d24/attachment.html>


More information about the rb-commits mailing list