#NEWLINE# def test_nested_requirements( ) : #NEWLINE# #INDENT# with temporary_dir ( ) as td1 : #NEWLINE# #INDENT# with temporary_dir ( ) as td2 : #NEWLINE# #INDENT# with open ( os . path . join ( td1 , 'requirements.txt' ) , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( dedent ( ( '\n            requirement1\n            requirement2\n            -r %s\n            -r %s\n        ' % ( os . path . join ( td2 , 'requirements_nonrelative.txt' ) , os . path . join ( 'relative' , 'requirements_relative.txt' ) ) ) ) ) #NEWLINE# #UNINDENT# with open ( os . path . join ( td2 , 'requirements_nonrelative.txt' ) , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( dedent ( '\n        requirement3\n        requirement4\n        ' ) ) #NEWLINE# #UNINDENT# os . mkdir ( os . path . join ( td1 , 'relative' ) ) #NEWLINE# with open ( os . path . join ( td1 , 'relative' , 'requirements_relative.txt' ) , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( dedent ( '\n        requirement5\n        requirement6\n        ' ) ) #NEWLINE# #UNINDENT# def rr( req ) : #NEWLINE# #INDENT# return ResolvableRequirement . from_string ( req , ResolverOptionsBuilder ( ) ) #NEWLINE# #UNINDENT# reqs = requirements_from_file ( os . path . join ( td1 , 'requirements.txt' ) ) #NEWLINE# assert ( reqs == [ rr ( ( 'requirement%d' % k ) ) for k in ( 1 , 2 , 3 , 4 , 5 , 6 ) ] )