def _start_file_watcher(self): self.watcher = QFileSystemWatcher() self.watcher_file_path = join(abspath("."), self._watcher_file_name) log.DEBUG("creating watcher file: %s" %(self.watcher_file_path)) write_to_file(self.watcher_file_path, "Delete this file to shutdown D2MP\n") self.watcher.addPath(abspath(".")) self.watcher.directoryChanged.connect(self._watcher_changed_callback)
def test_is_modded_tester(self): write_to_file(self.manager.dota_info_file(), self.dota_info_normal) self.assertFalse(self.manager.is_modded(), "should NOT be modded") write_to_file(self.manager.dota_info_file(), self.dota_info_modded) self.assertTrue(self.manager.is_modded(), "should be modded")
def test_is_modded_tester(self): write_to_file(self.manager.dota_info_file(), self.dota_info_normal) self.assertFalse(self.manager.is_modded(), "should NOT be modded") write_to_file(self.manager.dota_info_file(), self.dota_info_modded) self.assertTrue(self.manager.is_modded(), "should be modded")
def setUp(self): self.dota_info_normal = """ "GameInfo" { game "DOTA 2" gamelogo 1 type multiplayer_only nomodels 1 nohimodel 1 nocrosshair 0 GameData "dota.fgd" SupportsDX8 0 FileSystem { SteamAppId 816 ToolsAppId 211 SearchPaths { Game |gameinfo_path|. Game platform } } }""" self.dota_info_modded = """ "GameInfo" { game "DOTA 2" gamelogo 1 type multiplayer_only nomodels 1 nohimodel 1 nocrosshair 0 GameData "dota.fgd" SupportsDX8 0 FileSystem { SteamAppId 816 ToolsAppId 211 SearchPaths { Game |gameinfo_path|. Game platform Game |gameinfo_path|addons\d2moddin } } }""" new_dota_dir() self.manager = ModManager() # self.real_method = self.manager._dota_path # self.manager._dota_path = Mock(return_value = mkdtemp()) dota_subdir = join(self.manager._dota_path(), "dota") if not isdir(dota_subdir): mkdir(dota_subdir) write_to_file(self.manager.dota_info_file(), self.dota_info_normal)
def setUp(self): self.dota_info_normal = """ "GameInfo" { game "DOTA 2" gamelogo 1 type multiplayer_only nomodels 1 nohimodel 1 nocrosshair 0 GameData "dota.fgd" SupportsDX8 0 FileSystem { SteamAppId 816 ToolsAppId 211 SearchPaths { Game |gameinfo_path|. Game platform } } }""" self.dota_info_modded = """ "GameInfo" { game "DOTA 2" gamelogo 1 type multiplayer_only nomodels 1 nohimodel 1 nocrosshair 0 GameData "dota.fgd" SupportsDX8 0 FileSystem { SteamAppId 816 ToolsAppId 211 SearchPaths { Game |gameinfo_path|. Game platform Game |gameinfo_path|addons\d2moddin } } }""" new_dota_dir() self.manager = ModManager() # self.real_method = self.manager._dota_path # self.manager._dota_path = Mock(return_value = mkdtemp()) dota_subdir = join(self.manager._dota_path(), "dota") if not isdir(dota_subdir): mkdir(dota_subdir) write_to_file(self.manager.dota_info_file(), self.dota_info_normal)