<s> import os <EOL> import sys <EOL> import pytest <EOL> import menuinst <EOL> menu_dir = os . path . dirname ( __file__ ) <EOL> @ pytest . mark . skipif ( sys . platform != "<STR_LIT:win32>" , <EOL> reason = "<STR_LIT>" ) <EOL> class TestWindowsShortcuts ( object ) : <EOL> def test_install_folders_exist ( self ) : <EOL> from menuinst import dirs <EOL> for mode in [ "<STR_LIT:user>" , "<STR_LIT>" ] : <EOL> for path in dirs [ mode ] . values ( ) : <EOL> assert os . path . exists ( path ) <EOL> def test_create_and_remove_shortcut ( self ) : <EOL> nonadmin = os . path . join ( sys . prefix , "<STR_LIT>" ) <EOL> shortcut = os . path . join ( menu_dir , "<STR_LIT>" ) <EOL> has_nonadmin = os . path . exists ( nonadmin ) <EOL> for mode in [ "<STR_LIT:user>" , "<STR_LIT>" ] : <EOL> if mode == "<STR_LIT:user>" : <EOL> open ( nonadmin , '<STR_LIT:a>' ) . close ( ) <EOL> menuinst . install ( shortcut , remove = False ) <EOL> menuinst . install ( shortcut , remove = True ) <EOL> if os . path . exists ( nonadmin ) : <EOL> os . remove ( nonadmin ) <EOL> if has_nonadmin : <EOL> open ( nonadmin , '<STR_LIT:a>' ) . close ( ) </s>
