Esempio n. 1
0
 def test_no_config_file_for_dll_extra_paths(self):
     sys.platform = "win32"
     sys.version_info = (3, 8, 1)
     self.mock_add_dll()
     with self.assertLogs(level="DEBUG") as cm:
         self.assertIsNone(util.add_user_dll_extra_paths())
     self.assertIn("No user defined", cm.output[0])
Esempio n. 2
0
 def test_no_config_file_for_dll_extra_paths(self, monkeypatch, caplog):
     sys.platform = "win32"
     sys.version_info = (3, 8, 1)
     monkeypatch.setattr(
         os, "add_dll_directory", lambda *args, **kwargs: "", raising=False
     )
     with caplog.at_level(level=logging.DEBUG):
         assert util.add_user_dll_extra_paths() is None
     assert "No user defined" in caplog.records[0].message
Esempio n. 3
0
 def test_no_section_for_dll_extra_paths(self):
     sys.platform = "win32"
     self.mock_add_dll()
     config = ConfigParser()
     with open(self.config_path, "w") as f:
         config.write(f)
     with self.assertLogs(level="DEBUG") as cm:
         self.assertIsNone(util.add_user_dll_extra_paths())
     self.assertIn("NoOptionError or NoSectionError", cm.output[1])
Esempio n. 4
0
 def test_reading_config_file_for_dll_extra_paths(self):
     sys.platform = "win32"
     self.mock_add_dll()
     config = ConfigParser()
     config["Paths"] = {}
     config["Paths"][
         "dll_extra_paths"] = r"C:\Program Files;C:\Program Files (x86)"
     with open(self.config_path, "w") as f:
         config.write(f)
     self.assertEqual(util.add_user_dll_extra_paths(),
                      r"C:\Program Files;C:\Program Files (x86)")
Esempio n. 5
0
 def test_no_section_for_dll_extra_paths(self, monkeypatch, caplog):
     sys.platform = "win32"
     sys.version_info = (3, 8, 1)
     monkeypatch.setattr(
         os, "add_dll_directory", lambda *args, **kwargs: "", raising=False
     )
     config = ConfigParser()
     with open(self.config_path, "w") as f:
         config.write(f)
     with caplog.at_level(level=logging.DEBUG):
         assert util.add_user_dll_extra_paths() is None
     assert "NoOptionError or NoSectionError" in caplog.records[1].message
Esempio n. 6
0
 def test_reading_config_file_for_dll_extra_paths(self, monkeypatch):
     sys.platform = "win32"
     sys.version_info = (3, 8, 1)
     monkeypatch.setattr(
         os, "add_dll_directory", lambda *args, **kwargs: "", raising=False
     )
     config = ConfigParser()
     config["Paths"] = {}
     config["Paths"]["dll_extra_paths"] = r"C:\Program Files;C:\Program Files (x86)"
     with open(self.config_path, "w") as f:
         config.write(f)
     assert util.add_user_dll_extra_paths() == [
         r"C:\Program Files",
         r"C:\Program Files (x86)",
     ]
Esempio n. 7
0
 def test_reading_config_file_old_python(self, caplog):
     sys.platform = "win32"
     sys.version_info = (3, 7, 1)
     with caplog.at_level(level=logging.DEBUG):
         assert util.add_user_dll_extra_paths() is None
     assert "Not loading dll_extra_paths" in caplog.records[0].message
Esempio n. 8
0
 def test_reading_config_file_not_windows(self):
     sys.platform = "darwin"
     with self.assertLogs(level="DEBUG") as cm:
         self.assertIsNone(util.add_user_dll_extra_paths())
     self.assertIn("Not loading dll_extra_paths because it is not Windows",
                   cm.output[0])
Esempio n. 9
0
 def test_reading_config_file_old_python(self):
     sys.platform = "win32"
     sys.version_info = (3, 7, 1)
     with self.assertLogs(level="DEBUG") as cm:
         self.assertIsNone(util.add_user_dll_extra_paths())
     self.assertIn("Not loading dll_extra_paths", cm.output[0])
Esempio n. 10
0
 def test_reading_config_file_not_windows(self):
     sys.platform = "darwin"
     sys.version_info = (3, 8, 1)
     with self.assertLogs(level="DEBUG") as cm:
         self.assertIsNone(util.add_user_dll_extra_paths())
     self.assertIn("Not loading dll_extra_paths", cm.output[0])