Beispiel #1
0
 def test_run_power_bounded(self, set_up_logging_mock, read_config_mock):
     sys.argv[1:] = [self._ini_file]
     logger = logging.getLogger("")
     logger.setLevel(logging.ERROR)
     set_up_logging_mock.return_value = logger
     read_config_mock.return_value = self._config
     try:
         from jellyfysh.input_output_handler.input_handler.pdb_input_handler import PdbInputHandler
     except ImportError:
         print("\nSkip test if the .ini file {0} runs without an exception "
               "because MDAnalysis is not installed...".format(
                   self._ini_file),
               end="")
         raise SkipTest(
             "Skip unittests for hard-disk dipoles with cells configuration file "
             "because MDAnalysis is not installed.")
     print(
         "\nTest if the .ini file {0} runs without an exception...".format(
             self._ini_file),
         end="")
     # Redirect stdout to the null device
     with open(os.devnull, 'w') as devnull:
         with contextlib.redirect_stdout(devnull):
             run.main()
     set_up_logging_mock.assert_called_once_with(
         Namespace(config_file=self._ini_file, logfile=None, verbose=None))
     read_config_mock.assert_called_once_with(self._ini_file)
     self.assertIn("TestHardDiskDipolesCells.dat", os.listdir("."))
 def test_run_coulomb_cell_veto_lj_inverted(self, read_config_mock):
     sys.argv[1:] = [self._ini_file]
     read_config_mock.return_value = self._config
     print("\nTest if the .ini file {0} runs without an exception...".format(self._ini_file), end="")
     # Redirect stdout to the null device
     with open(os.devnull, 'w') as devnull:
         with contextlib.redirect_stdout(devnull):
             run.main()
     read_config_mock.assert_called_once_with(self._ini_file)
     self.assertIn("Test_CoulombCellVeto_LjInverted.dat", os.listdir("."))
 def test_run_dipole_factors_outside_first(self, read_config_mock):
     sys.argv[1:] = [self._ini_file]
     read_config_mock.return_value = self._config
     print("\nTest if the .ini file {0} runs without an exception...".format(self._ini_file), end="")
     # Redirect stdout to the null device
     with open(os.devnull, 'w') as devnull:
         with contextlib.redirect_stdout(devnull):
             run.main()
     read_config_mock.assert_called_once_with(self._ini_file)
     self.assertIn("TestDipoleFactorsOutsideFirst_13.dat", os.listdir("."))
     self.assertIn("TestDipoleFactorsOutsideFirst_14.dat", os.listdir("."))
 def test_run_single_molecule(self, read_config_mock):
     sys.argv[1:] = [self._ini_file]
     read_config_mock.return_value = self._config
     print(
         "\nTest if the .ini file {0} runs without an exception...".format(
             self._ini_file),
         end="")
     # Redirect stdout to the null device
     with open(os.devnull, 'w') as devnull:
         with contextlib.redirect_stdout(devnull):
             run.main()
     read_config_mock.assert_called_once_with(self._ini_file)
     self.assertIn("TestSingleMolecule_Angle.dat", os.listdir("."))
     self.assertIn("TestSingleMolecule_Length.dat", os.listdir("."))
Beispiel #5
0
 def test_run_power_bounded(self, set_up_logging_mock, read_config_mock):
     sys.argv[1:] = [self._ini_file]
     logger = logging.getLogger("")
     logger.setLevel(logging.ERROR)
     set_up_logging_mock.return_value = logger
     read_config_mock.return_value = self._config
     print(
         "\nTest if the .ini file {0} runs without an exception...".format(
             self._ini_file),
         end="")
     # Redirect stdout to the null device
     with open(os.devnull, 'w') as devnull:
         with contextlib.redirect_stdout(devnull):
             run.main()
     set_up_logging_mock.assert_called_once_with(
         Namespace(config_file=self._ini_file, logfile=None, verbose=None))
     read_config_mock.assert_called_once_with(self._ini_file)
     self.assertIn("TestSingleHardDiskDipole.dat", os.listdir("."))