def test_source_detect(): from rosdep2.platforms.source import source_detect, SourceInstall resolved = SourceInstall() resolved.check_presence_command = """#!/bin/bash exit 0 """ assert [] == source_detect([]) assert [resolved] == source_detect([resolved]) def yes(*args, **kwds): return 0 def no(*args, **kwds): return 1 resolved = [ SourceInstall(), SourceInstall(), SourceInstall(), SourceInstall() ] for r in resolved: r.check_presence_command = '' retval = source_detect(resolved, exec_fn=yes) assert resolved == retval, retval assert [] == source_detect(resolved, exec_fn=no)
def test_source_detect(): from rosdep2.platforms.source import source_detect, SourceInstall resolved = SourceInstall() resolved.check_presence_command = """#!/bin/bash exit 0 """ assert [] == source_detect([]) assert [resolved] == source_detect([resolved]) def yes(*args, **kwds): return 0 def no(*args, **kwds): return 1 resolved = [SourceInstall(), SourceInstall(), SourceInstall(), SourceInstall()] for r in resolved: r.check_presence_command = '' retval = source_detect(resolved, exec_fn=yes) assert resolved == retval, retval assert [] == source_detect(resolved, exec_fn=no)