#NEWLINE# def test_shading_does_not_influence_permissions( self ) : #NEWLINE# #INDENT# with temporary_dir ( root_dir = get_buildroot ( ) ) as tmpdir : #NEWLINE# #INDENT# tmp_name = os . path . basename ( tmpdir ) #NEWLINE# with open ( os . path . join ( tmpdir , 'Foo.java' ) , 'w+' ) as f : #NEWLINE# #INDENT# f . write ( 'public class Foo {}\n' ) #NEWLINE# #UNINDENT# with open ( os . path . join ( tmpdir , 'BUILD.lib' ) , 'w+' ) as f : #NEWLINE# #INDENT# f . write ( dedent ( "\n          java_library(name='lib',\n            sources=['Foo.java'],\n          )\n        " ) ) #NEWLINE# #UNINDENT# with open ( os . path . join ( tmpdir , 'BUILD' ) , 'w+' ) as f : #NEWLINE# #INDENT# f . write ( dedent ( "\n          jvm_binary(name='{name}',\n            basename='{name}',\n            dependencies=[\n              ':lib',\n            ],\n          )\n        " ) . format ( name = tmp_name ) ) #NEWLINE# #UNINDENT# jar_path = os . path . join ( 'dist' , '{}.jar' . format ( tmp_name ) ) #NEWLINE# self . run_pants ( [ 'clean-all' ] ) #NEWLINE# self . assert_success ( self . run_pants ( [ 'binary' , tmpdir ] ) ) #NEWLINE# permissions = os . stat ( jar_path ) . st_mode #NEWLINE# with open ( os . path . join ( tmpdir , 'BUILD' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( dedent ( "\n          jvm_binary(name='{name}',\n            basename='{name}',\n            dependencies=[\n              ':lib',\n            ],\n            shading_rules=[\n              shading_relocate_package('org.foo.bar'),\n            ],\n          )\n        " ) . format ( name = tmp_name ) ) #NEWLINE# #UNINDENT# self . run_pants ( [ 'clean-all' ] ) #NEWLINE# os . remove ( jar_path ) #NEWLINE# self . assert_success ( self . run_pants ( [ 'binary' , tmpdir ] ) ) #NEWLINE# self . assertEquals ( permissions , os . stat ( jar_path ) . st_mode )