<s> from os import listdir <EOL> from os . path import isdir , isfile , join <EOL> import re <EOL> from platformio . commands . lib import cli <EOL> from platformio import util <EOL> def validate_libfolder ( ) : <EOL> libs_path = util . get_lib_dir ( ) <EOL> installed_libs = listdir ( libs_path ) <EOL> for lib in installed_libs : <EOL> assert isdir ( join ( libs_path , lib ) ) <EOL> assert isfile ( join ( libs_path , lib , "<STR_LIT>" ) ) and isfile ( <EOL> join ( libs_path , lib , "<STR_LIT>" ) ) <EOL> def test_lib_search ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> match = re . search ( r"<STR_LIT>" , result . output ) <EOL> assert int ( match . group ( <NUM_LIT:1> ) ) > <NUM_LIT:2> <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> match = re . search ( r"<STR_LIT>" , result . output ) <EOL> assert int ( match . group ( <NUM_LIT:1> ) ) == <NUM_LIT:1> <EOL> def test_lib_install ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> validate_libfolder ( ) <EOL> def test_lib_list ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT:list>" ] ) <EOL> validate_cliresult ( result ) <EOL> assert "<STR_LIT>" in result . output and "<STR_LIT>" in result . output <EOL> def test_lib_show ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> assert "<STR_LIT>" in result . output and "<STR_LIT>" in result . output <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> assert "<STR_LIT>" in result . output and "<STR_LIT>" in result . output <EOL> def test_lib_update ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) <EOL> assert "<STR_LIT>" in result . output and "<STR_LIT>" in result . output <EOL> def test_lib_uninstall ( clirunner , validate_cliresult ) : <EOL> result = clirunner . invoke ( cli , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> validate_cliresult ( result ) </s>
