#NEWLINE# def test_copy_move_delete( self ) : #NEWLINE# #INDENT# from plumbum.cmd import touch #NEWLINE# with local . tempdir ( ) as dir : #NEWLINE# #INDENT# ( dir / 'orog' ) . mkdir ( ) #NEWLINE# ( ( dir / 'orog' ) / 'rec' ) . mkdir ( ) #NEWLINE# for i in range ( 20 ) : #NEWLINE# #INDENT# touch ( ( ( dir / 'orog' ) / ( 'f%d.txt' % ( i , ) ) ) ) #NEWLINE# #UNINDENT# for i in range ( 20 , 40 ) : #NEWLINE# #INDENT# touch ( ( ( ( dir / 'orog' ) / 'rec' ) / ( 'f%d.txt' % ( i , ) ) ) ) #NEWLINE# #UNINDENT# move ( ( dir / 'orog' ) , ( dir / 'orig' ) ) #NEWLINE# s1 = sorted ( ( f . name for f in ( dir / 'orig' ) . walk ( ) ) ) #NEWLINE# copy ( ( dir / 'orig' ) , ( dir / 'dup' ) ) #NEWLINE# s2 = sorted ( ( f . name for f in ( dir / 'dup' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s2 ) #NEWLINE# with SshMachine ( 'localhost' ) as rem : #NEWLINE# #INDENT# with rem . tempdir ( ) as dir2 : #NEWLINE# #INDENT# copy ( ( dir / 'orig' ) , dir2 ) #NEWLINE# s3 = sorted ( ( f . name for f in ( dir2 / 'orig' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s3 ) #NEWLINE# copy ( ( dir2 / 'orig' ) , ( dir2 / 'dup' ) ) #NEWLINE# s4 = sorted ( ( f . name for f in ( dir2 / 'dup' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s4 ) #NEWLINE# copy ( ( dir2 / 'dup' ) , ( dir / 'dup2' ) ) #NEWLINE# s5 = sorted ( ( f . name for f in ( dir / 'dup2' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s5 ) #NEWLINE# with SshMachine ( 'localhost' ) as rem2 : #NEWLINE# #INDENT# with rem2 . tempdir ( ) as dir3 : #NEWLINE# #INDENT# copy ( ( dir2 / 'dup' ) , dir3 ) #NEWLINE# s6 = sorted ( ( f . name for f in ( dir3 / 'dup' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s6 ) #NEWLINE# move ( ( dir3 / 'dup' ) , ( dir / 'superdup' ) ) #NEWLINE# assert ( not ( dir3 / 'dup' ) . exists ( ) ) #NEWLINE# s7 = sorted ( ( f . name for f in ( dir / 'superdup' ) . walk ( ) ) ) #NEWLINE# assert ( s1 == s7 ) #NEWLINE# delete ( dir )