Merge pull request #287 from donfranio/master

add test for util.which
This commit is contained in:
tobi-wan-kenobi 2018-08-28 15:11:47 +02:00 committed by GitHub
commit 7a4f3a98e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -3,7 +3,7 @@
echo "testing with $(python2 -V 2>&1)" echo "testing with $(python2 -V 2>&1)"
python2 $(which nosetests) -v --with-coverage --cover-erase tests/ python2 $(which nosetests) -v --with-coverage --cover-erase tests/
if [ $? == 0 ]; then if test $? -eq 0 ; then
echo echo
echo "testing with $(python3 -V 2>&1)" echo "testing with $(python3 -V 2>&1)"

View file

@ -2,6 +2,7 @@
import mock import mock
import unittest import unittest
import re
import tests.mocks as mocks import tests.mocks as mocks
@ -53,4 +54,12 @@ class TestUtil(unittest.TestCase):
with self.assertRaises(RuntimeError): with self.assertRaises(RuntimeError):
execute(self.some_command_with_args) execute(self.some_command_with_args)
def test_which(self):
program = "iwgetid"
self.assertTrue(
which(program) is None or
re.search('/(' + program + ')$', which(program))
)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4