<s> import unittest <EOL> from conans . test . tools import TestClient <EOL> from conans . model . ref import ConanFileReference , PackageReference <EOL> from conans . paths import CONANFILE , CONANINFO <EOL> import os <EOL> from conans . model . info import ConanInfo <EOL> from conans . test . utils . cpp_test_files import cpp_hello_conan_files <EOL> from conans . paths import CONANFILE_TXT <EOL> class InstallTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . client = TestClient ( ) <EOL> self . settings = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def _create ( self , number , version , deps = None , export = True , no_config = False ) : <EOL> files = cpp_hello_conan_files ( number , version , deps ) <EOL> files = { CONANFILE : files [ CONANFILE ] . replace ( "<STR_LIT>" , "<STR_LIT>" ) } <EOL> if no_config : <EOL> files [ CONANFILE ] = files [ CONANFILE ] . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . client . save ( files , clean_first = True ) <EOL> if export : <EOL> self . client . run ( "<STR_LIT>" ) <EOL> def reuse_test ( self ) : <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , export = False ) <EOL> for lang , id0 , id1 in [ ( <NUM_LIT:0> , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> ( <NUM_LIT:1> , "<STR_LIT>" , <EOL> "<STR_LIT>" ) ] : <EOL> self . client . run ( "<STR_LIT>" % ( lang , self . settings ) ) <EOL> info_path = os . path . join ( self . client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> conan_info . settings . dumps ( ) ) <EOL> self . assertEqual ( "<STR_LIT>" % lang , conan_info . options . dumps ( ) ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> hello0 = self . client . paths . package ( PackageReference ( conan_ref , id0 ) ) <EOL> hello0_info = os . path . join ( hello0 , CONANINFO ) <EOL> hello0_conan_info = ConanInfo . load_file ( hello0_info ) <EOL> self . assertEqual ( lang , hello0_conan_info . options . language ) <EOL> package_ref1 = PackageReference ( ConanFileReference . loads ( "<STR_LIT>" ) , <EOL> id1 ) <EOL> hello1 = self . client . paths . package ( package_ref1 ) <EOL> hello1_info = os . path . join ( hello1 , CONANINFO ) <EOL> hello1_conan_info = ConanInfo . load_file ( hello1_info ) <EOL> self . assertEqual ( lang , hello1_conan_info . options . language ) <EOL> def upper_option_test ( self ) : <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , no_config = True ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , no_config = True ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , export = False , no_config = True ) <EOL> self . client . run ( "<STR_LIT>" <EOL> "<STR_LIT>" % self . settings ) <EOL> info_path = os . path . join ( self . client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" , conan_info . options . dumps ( ) ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> hello0 = self . client . paths . package ( PackageReference ( conan_ref , <EOL> "<STR_LIT>" ) ) <EOL> hello0_info = os . path . join ( hello0 , CONANINFO ) <EOL> hello0_conan_info = ConanInfo . load_file ( hello0_info ) <EOL> self . assertEqual ( <NUM_LIT:1> , hello0_conan_info . options . language ) <EOL> package_ref1 = PackageReference ( ConanFileReference . loads ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" ) <EOL> hello1 = self . client . paths . package ( package_ref1 ) <EOL> hello1_info = os . path . join ( hello1 , CONANINFO ) <EOL> hello1_conan_info = ConanInfo . load_file ( hello1_info ) <EOL> self . assertEqual ( <NUM_LIT:0> , hello1_conan_info . options . language ) <EOL> def inverse_upper_option_test ( self ) : <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , no_config = True ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , no_config = True ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , export = False , no_config = True ) <EOL> self . client . run ( "<STR_LIT>" <EOL> "<STR_LIT>" % self . settings ) <EOL> info_path = os . path . join ( self . client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" , conan_info . options . dumps ( ) ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> hello0 = self . client . paths . package ( PackageReference ( conan_ref , <EOL> "<STR_LIT>" ) ) <EOL> hello0_info = os . path . join ( hello0 , CONANINFO ) <EOL> hello0_conan_info = ConanInfo . load_file ( hello0_info ) <EOL> self . assertEqual ( "<STR_LIT>" , hello0_conan_info . options . dumps ( ) ) <EOL> package_ref1 = PackageReference ( ConanFileReference . loads ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" ) <EOL> hello1 = self . client . paths . package ( package_ref1 ) <EOL> hello1_info = os . path . join ( hello1 , CONANINFO ) <EOL> hello1_conan_info = ConanInfo . load_file ( hello1_info ) <EOL> self . assertEqual ( "<STR_LIT>" , hello1_conan_info . options . dumps ( ) ) <EOL> def upper_option_txt_test ( self ) : <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , no_config = True ) <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] , no_config = True ) <EOL> files = cpp_hello_conan_files ( "<STR_LIT>" , "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> files . pop ( CONANFILE ) <EOL> files [ CONANFILE_TXT ] = """<STR_LIT>""" <EOL> self . client . save ( files , clean_first = True ) <EOL> self . client . run ( "<STR_LIT>" % self . settings ) <EOL> info_path = os . path . join ( self . client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" , conan_info . options . dumps ( ) ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> hello0 = self . client . paths . package ( PackageReference ( conan_ref , <EOL> "<STR_LIT>" ) ) <EOL> hello0_info = os . path . join ( hello0 , CONANINFO ) <EOL> hello0_conan_info = ConanInfo . load_file ( hello0_info ) <EOL> self . assertEqual ( <NUM_LIT:1> , hello0_conan_info . options . language ) <EOL> package_ref1 = PackageReference ( ConanFileReference . loads ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" ) <EOL> hello1 = self . client . paths . package ( package_ref1 ) <EOL> hello1_info = os . path . join ( hello1 , CONANINFO ) <EOL> hello1_conan_info = ConanInfo . load_file ( hello1_info ) <EOL> self . assertEqual ( <NUM_LIT:0> , hello1_conan_info . options . language ) <EOL> def change_option_txt_test ( self ) : <EOL> self . _create ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> client = TestClient ( base_folder = self . client . base_folder ) <EOL> files = { CONANFILE_TXT : """<STR_LIT>""" } <EOL> client . save ( files ) <EOL> client . run ( "<STR_LIT>" % self . settings ) <EOL> info_path = os . path . join ( client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" , conan_info . options . dumps ( ) ) <EOL> self . assertIn ( "<STR_LIT>" , conan_info . full_options . dumps ( ) ) <EOL> self . assertIn ( "<STR_LIT>" , <EOL> conan_info . full_requires . dumps ( ) ) <EOL> files = { CONANFILE_TXT : """<STR_LIT>""" } <EOL> client . save ( files ) <EOL> client . run ( "<STR_LIT>" % self . settings ) <EOL> info_path = os . path . join ( client . current_folder , CONANINFO ) <EOL> conan_info = ConanInfo . load_file ( info_path ) <EOL> self . assertEqual ( "<STR_LIT>" , conan_info . options . dumps ( ) ) <EOL> self . assertIn ( "<STR_LIT>" , conan_info . full_options . dumps ( ) ) <EOL> self . assertIn ( "<STR_LIT>" , <EOL> conan_info . full_requires . dumps ( ) ) </s>
