def test__handle_all_site_scons_dirs_win32(self): _defaultArgpath = [] def _handle_site_scons_dir(topdir): _defaultArgpath.insert( 0, os.path.join(topdir, 'site_scons', 'site_arguments')) env = self.fakeEnv('win32') with mock.patch('SCons.Platform.platform_default', return_value='win32'), \ mock.patch('os.path.expandvars', side_effect = lambda x : self.expandvars('win32', x)), \ mock.patch('os.path.expanduser', side_effect = lambda x : self.expanduser('win32', x)), \ mock.patch('os.path.join', side_effect = lambda *x : self.pathjoin('win32', *x)), \ mock.patch('SConsArguments.Importer._handle_site_scons_dir', side_effect = _handle_site_scons_dir): tested._handle_all_site_scons_dirs('C:\\Users\\ptomulik\\foo') self.assertEqual(_defaultArgpath, [ 'C:\\Users\\ptomulik\\foo\\site_scons\\site_arguments', 'C:\\Users\\ptomulik\\home\\.scons\\site_scons\\site_arguments', '%s\\scons\\site_scons\\site_arguments' % env['$APPDATA'], '%s\\Local Settings\\Application Data\\scons\\site_scons\\site_arguments' % env['$USERPROFILE'], '%s\\Application Data\\scons\\site_scons\\site_arguments' % env['$ALLUSERSPROFILE'] ])
def test__handle_all_site_scons_dirs_other(self): _defaultArgpath = [] def _handle_site_scons_dir(topdir): _defaultArgpath.insert( 0, os.path.join(topdir, 'site_scons', 'site_arguments')) env = self.fakeEnv('other') with mock.patch('SCons.Platform.platform_default', return_value='other'), \ mock.patch('os.path.expandvars', side_effect = lambda x : self.expandvars('other', x)), \ mock.patch('os.path.expanduser', side_effect = lambda x : self.expanduser('other', x)), \ mock.patch('os.path.join', side_effect = lambda *x : self.pathjoin('other', *x)), \ mock.patch('SConsArguments.Importer._handle_site_scons_dir', side_effect = _handle_site_scons_dir): tested._handle_all_site_scons_dirs('/home/ptomulik/foo') self.assertEqual(_defaultArgpath, [ '/home/ptomulik/foo/site_scons/site_arguments', '/home/ptomulik/.scons/site_scons/site_arguments', '/usr/share/scons/site_scons/site_arguments' ])