#NEWLINE# def test_safe_classpath( self ) : #NEWLINE# #INDENT# 'For directory structure like:\n\n       ./\n       ./libs/A.jar\n       ./libs/resources/\n       ./synthetic_jar_dir\n\n       Verify a synthetic jar with the following classpath in manifest is created:\n\n        Class-Path: ../libs/A.jar:../libs/resources/\n    ' #NEWLINE# RESOURCES = 'resources' #NEWLINE# LIB_DIR = 'libs' #NEWLINE# JAR_FILE = 'A.jar' #NEWLINE# SYNTHENTIC_JAR_DIR = 'synthetic_jar_dir' #NEWLINE# basedir = safe_mkdtemp ( ) #NEWLINE# lib_dir = os . path . join ( basedir , LIB_DIR ) #NEWLINE# synthetic_jar_dir = os . path . join ( basedir , SYNTHENTIC_JAR_DIR ) #NEWLINE# resource_dir = os . path . join ( lib_dir , RESOURCES ) #NEWLINE# jar_file = os . path . join ( lib_dir , JAR_FILE ) #NEWLINE# for dir in ( lib_dir , resource_dir , synthetic_jar_dir ) : #NEWLINE# #INDENT# safe_mkdir ( dir ) #NEWLINE# #UNINDENT# touch ( jar_file ) #NEWLINE# classpath = [ jar_file , resource_dir ] #NEWLINE# safe_cp = safe_classpath ( classpath , synthetic_jar_dir ) #NEWLINE# self . assertEquals ( 1 , len ( safe_cp ) ) #NEWLINE# safe_jar = safe_cp [ 0 ] #NEWLINE# self . assertTrue ( os . path . exists ( safe_jar ) ) #NEWLINE# self . assertEquals ( synthetic_jar_dir , os . path . dirname ( safe_jar ) ) #NEWLINE# with open_zip ( dir ) as synthetic_jar : #NEWLINE# #INDENT# self . assertListEqual ( [ Manifest . PATH ] , synthetic_jar . namelist ( ) ) #NEWLINE# self . assertEquals ( '{}: ../{}/{} ../{}/{}/\n' . format ( Manifest . CLASS_PATH , LIB_DIR , JAR_FILE , LIB_DIR , RESOURCES ) , synthetic_jar . read ( Manifest . PATH ) . replace ( '\n ' , '' ) )