<s> import os <EOL> from squadron . fileio . symlink import force_create_symlink <EOL> def compare_contents ( one , two ) : <EOL> with open ( one ) as f1 : <EOL> with open ( two ) as f2 : <EOL> return f1 . read ( ) == f2 . read ( ) <EOL> def test_symlink ( tmpdir ) : <EOL> tmpdir = str ( tmpdir ) <EOL> source1 = os . path . join ( tmpdir , '<STR_LIT>' ) <EOL> with open ( source1 , '<STR_LIT:w>' ) as f : <EOL> f . write ( '<STR_LIT>' ) <EOL> dest = os . path . join ( tmpdir , '<STR_LIT>' ) <EOL> force_create_symlink ( source1 , dest ) <EOL> assert os . path . islink ( dest ) <EOL> assert compare_contents ( source1 , dest ) <EOL> source2 = os . path . join ( tmpdir , '<STR_LIT>' ) <EOL> with open ( source2 , '<STR_LIT:w>' ) as f : <EOL> f . write ( '<STR_LIT>' ) <EOL> force_create_symlink ( source2 , dest ) <EOL> assert os . path . islink ( dest ) <EOL> assert compare_contents ( source2 , dest ) </s>
