1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright 2022 Google LLC 3# 4"""Bintool used for testing 5 6This is not a real bintool, just one used for testing""" 7 8from binman import bintool 9 10# pylint: disable=C0103 11class Bintool_testing(bintool.Bintool): 12 """Bintool used for testing""" 13 def __init__(self, name): 14 super().__init__(name, 'testing') 15 self.present = False 16 self.install = False 17 self.disable = False 18 19 def is_present(self): 20 if self.present is None: 21 return super().is_present() 22 return self.present 23 24 def version(self): 25 return '123' 26 27 def fetch(self, method): 28 if self.disable: 29 return super().fetch(method) 30 if method == bintool.FETCH_BIN: 31 if self.install: 32 return self.apt_install('package') 33 return self.fetch_from_drive('junk') 34 if method == bintool.FETCH_BUILD: 35 return self.build_from_git('url', 'target', 'pathname') 36 return None 37