<s> import unittest <EOL> from conans . test . tools import TestClient <EOL> import os <EOL> from conans . model . ref import PackageReference , ConanFileReference <EOL> from conans . util . files import load <EOL> base_conanfile = '''<STR_LIT>''' <EOL> class SystemReqsTest ( unittest . TestCase ) : <EOL> def per_package_test ( self ) : <EOL> client = TestClient ( ) <EOL> files = { '<STR_LIT>' : base_conanfile . replace ( "<STR_LIT>" , "<STR_LIT>" ) } <EOL> client . save ( files ) <EOL> client . run ( "<STR_LIT>" ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , client . user_io . out ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs ( conan_ref ) ) ) <EOL> package_ref = PackageReference ( conan_ref , "<STR_LIT>" ) <EOL> load_file = load ( client . paths . system_reqs_package ( package_ref ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertNotIn ( "<STR_LIT>" , client . user_io . out ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs ( conan_ref ) ) ) <EOL> load_file = load ( client . paths . system_reqs_package ( package_ref ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , client . user_io . out ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs ( conan_ref ) ) ) <EOL> package_ref2 = PackageReference ( conan_ref , "<STR_LIT>" ) <EOL> load_file = load ( client . paths . system_reqs_package ( package_ref2 ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" , ignore_error = True ) <EOL> self . assertTrue ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> self . assertTrue ( os . path . exists ( client . paths . system_reqs_package ( package_ref2 ) ) ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref2 ) ) ) <EOL> def global_test ( self ) : <EOL> client = TestClient ( ) <EOL> files = { '<STR_LIT>' : base_conanfile . replace ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) } <EOL> client . save ( files ) <EOL> client . run ( "<STR_LIT>" ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , client . user_io . out ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> package_ref = PackageReference ( conan_ref , "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> load_file = load ( client . paths . system_reqs ( conan_ref ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertNotIn ( "<STR_LIT>" , client . user_io . out ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> load_file = load ( client . paths . system_reqs ( conan_ref ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertNotIn ( "<STR_LIT>" , client . user_io . out ) <EOL> package_ref2 = PackageReference ( conan_ref , "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref2 ) ) ) <EOL> load_file = load ( client . paths . system_reqs ( conan_ref ) ) <EOL> self . assertIn ( "<STR_LIT>" , load_file ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref ) ) ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs_package ( package_ref2 ) ) ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs ( conan_ref ) ) ) <EOL> def wrong_output_test ( self ) : <EOL> client = TestClient ( ) <EOL> files = { '<STR_LIT>' : base_conanfile . replace ( "<STR_LIT>" , "<STR_LIT>" ) . <EOL> replace ( '<STR_LIT>' , '<STR_LIT:None>' ) } <EOL> client . save ( files ) <EOL> client . run ( "<STR_LIT>" ) <EOL> client . run ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , client . user_io . out ) <EOL> conan_ref = ConanFileReference . loads ( "<STR_LIT>" ) <EOL> self . assertFalse ( os . path . exists ( client . paths . system_reqs ( conan_ref ) ) ) <EOL> package_ref = PackageReference ( conan_ref , "<STR_LIT>" ) <EOL> load_file = load ( client . paths . system_reqs_package ( package_ref ) ) <EOL> self . assertEqual ( '<STR_LIT>' , load_file ) </s>
