<s> import ntpath <EOL> import os <EOL> import posixpath <EOL> import sys <EOL> import pretend <EOL> from pip . utils import appdirs <EOL> class TestUserCacheDir : <EOL> def test_user_cache_dir_win ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert ( appdirs . user_cache_dir ( "<STR_LIT>" ) == <EOL> "<STR_LIT>" ) <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_user_cache_dir_osx ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_cache_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_cache_dir_linux ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_cache_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_cache_dir_linux_override ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_cache_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_cache_dir_linux_home_slash ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT:/>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_cache_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> class TestSiteConfigDirs : <EOL> def test_site_config_dirs_win ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert appdirs . site_config_dirs ( "<STR_LIT>" ) == [ "<STR_LIT>" ] <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_site_config_dirs_osx ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . site_config_dirs ( "<STR_LIT>" ) == [ "<STR_LIT>" ] <EOL> def test_site_config_dirs_linux ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . site_config_dirs ( "<STR_LIT>" ) == [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> def test_site_config_dirs_linux_override ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setattr ( os , "<STR_LIT>" , '<STR_LIT::>' ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . site_config_dirs ( "<STR_LIT>" ) == [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> class TestUserDataDir : <EOL> def test_user_data_dir_win_no_roaming ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert ( appdirs . user_data_dir ( "<STR_LIT>" ) == <EOL> "<STR_LIT>" ) <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_user_data_dir_win_yes_roaming ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert ( <EOL> appdirs . user_data_dir ( "<STR_LIT>" , roaming = True ) == <EOL> "<STR_LIT>" <EOL> ) <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_user_data_dir_osx ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert ( appdirs . user_data_dir ( "<STR_LIT>" ) == <EOL> "<STR_LIT>" ) <EOL> def test_user_data_dir_linux ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_data_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_data_dir_linux_override ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_data_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_data_dir_linux_home_slash ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT:/>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_data_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> class TestUserConfigDir : <EOL> def test_user_config_dir_win_no_roaming ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert ( <EOL> appdirs . user_config_dir ( "<STR_LIT>" , roaming = False ) == <EOL> "<STR_LIT>" <EOL> ) <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_user_config_dir_win_yes_roaming ( self , monkeypatch ) : <EOL> @ pretend . call_recorder <EOL> def _get_win_folder ( base ) : <EOL> return "<STR_LIT>" <EOL> monkeypatch . setattr ( <EOL> appdirs , <EOL> "<STR_LIT>" , <EOL> _get_win_folder , <EOL> raising = False , <EOL> ) <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , True ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , ntpath ) <EOL> assert ( appdirs . user_config_dir ( "<STR_LIT>" ) == <EOL> "<STR_LIT>" ) <EOL> assert _get_win_folder . calls == [ pretend . call ( "<STR_LIT>" ) ] <EOL> def test_user_config_dir_osx ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert ( appdirs . user_config_dir ( "<STR_LIT>" ) == <EOL> "<STR_LIT>" ) <EOL> def test_user_config_dir_linux ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_config_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_config_dir_linux_override ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_config_dir ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> def test_user_config_dir_linux_home_slash ( self , monkeypatch ) : <EOL> monkeypatch . setattr ( appdirs , "<STR_LIT>" , False ) <EOL> monkeypatch . setattr ( os , "<STR_LIT:path>" , posixpath ) <EOL> monkeypatch . delenv ( "<STR_LIT>" ) <EOL> monkeypatch . setenv ( "<STR_LIT>" , "<STR_LIT:/>" ) <EOL> monkeypatch . setattr ( sys , "<STR_LIT>" , "<STR_LIT>" ) <EOL> assert appdirs . user_config_dir ( "<STR_LIT>" ) == "<STR_LIT>" </s>
