|
10 | 10 | from threading import Timer |
11 | 11 | import subprocess |
12 | 12 |
|
13 | | -from Npp import * |
| 13 | +from Npp import notepad, editor, console, WINVER, LANGTYPE, MENUCOMMAND, BUFFERENCODING |
14 | 14 |
|
15 | 15 | EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, |
16 | 16 | ctypes.wintypes.HWND, |
@@ -193,7 +193,7 @@ def test_saveAsCopy(self): |
193 | 193 | copyFilename = self.get_temp_filename() |
194 | 194 | notepad.saveAs(realFilename) |
195 | 195 | notepad.saveAsCopy(copyFilename) |
196 | | - editor.write('-OriginalChanged') |
| 196 | + editor.appendText('-OriginalChanged') |
197 | 197 | notepad.save() |
198 | 198 | notepad.close() |
199 | 199 | self.check_file_contents(realFilename, 'Hello world - saveAsCopy-OriginalChanged') |
@@ -693,7 +693,7 @@ def test_getAppdataPluginsAllowed(self): |
693 | 693 | npp_dir = notepad.getNppDir() |
694 | 694 | appdata_plugins_allowed_file = os.path.join(npp_dir, 'allowAppDataPlugins.xml') |
695 | 695 | appdata_plugins_allowed = os.path.exists(appdata_plugins_allowed_file) |
696 | | - do_local_conf_file = os.path.join(npp_dir, 'doLocalConf.xml') |
| 696 | + _ = os.path.join(npp_dir, 'doLocalConf.xml') |
697 | 697 | do_local_conf = os.path.exists(appdata_plugins_allowed_file) |
698 | 698 |
|
699 | 699 | if appdata_plugins_allowed and do_local_conf: |
@@ -854,9 +854,13 @@ def test_getNbUserLang(self): |
854 | 854 | self.__test_invalid_parameter_passed(notepad.getNbUserLang) |
855 | 855 | number_of_udls = notepad.getNbUserLang() |
856 | 856 | userdefined_xml_file = os.path.join(self._get_config_directory(), r'userDefineLang.xml') |
| 857 | + userdefined_xml_path = os.path.join(self._get_config_directory(), r'userDefineLangs') |
| 858 | + number_of_user_langs_from_xml = 0 |
857 | 859 | if os.path.exists(userdefined_xml_file): |
858 | 860 | udl_doc = et.parse(userdefined_xml_file) |
859 | | - number_of_user_langs_from_xml = len(udl_doc.findall('UserLang')) |
| 861 | + number_of_user_langs_from_xml += len(udl_doc.findall('UserLang')) |
| 862 | + if os.path.exists(userdefined_xml_path): |
| 863 | + number_of_user_langs_from_xml += len([x for x in os.listdir(userdefined_xml_path) if x.endswith('.xml')]) |
860 | 864 | else: |
861 | 865 | number_of_user_langs_from_xml = 0 |
862 | 866 | self.assertIsInstance(number_of_udls, int) |
|
0 commit comments