Merge pull request #2758 from akohlmey/collected-small-changes
Collected small changes and fixes for the next patch release
This commit is contained in:
@ -778,6 +778,7 @@ TEST(PairStyle, omp)
|
||||
TEST(PairStyle, gpu)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("GPU")) GTEST_SKIP();
|
||||
if (!Info::has_gpu_device()) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
const char *args_neigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"};
|
||||
|
||||
@ -33,6 +33,13 @@ class PythonCapabilities(unittest.TestCase):
|
||||
def test_version(self):
|
||||
self.assertGreaterEqual(self.lmp.version(), 20200824)
|
||||
|
||||
def test_os_info(self):
|
||||
import platform
|
||||
|
||||
system = platform.system()
|
||||
osinfo = self.lmp.get_os_info()
|
||||
self.assertEqual(osinfo.find(system),0)
|
||||
|
||||
def test_has_gzip_support(self):
|
||||
self.assertEqual(self.lmp.has_gzip_support, self.cmake_cache['WITH_GZIP'])
|
||||
|
||||
@ -158,5 +165,14 @@ class PythonCapabilities(unittest.TestCase):
|
||||
if self.cmake_cache['GPU_PREC'].lower() == 'single':
|
||||
self.assertIn('single',settings['GPU']['precision'])
|
||||
|
||||
def test_gpu_device(self):
|
||||
|
||||
info = self.lmp.get_gpu_device_info()
|
||||
if self.lmp.has_gpu_device:
|
||||
self.assertTrue(info)
|
||||
self.assertGreaterEqual(info.find("Device"),0)
|
||||
else:
|
||||
self.assertFalse(info)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@ -50,6 +50,16 @@ class PythonOpen(unittest.TestCase):
|
||||
self.assertIsNot(lmp.lmp,None)
|
||||
self.assertEqual(lmp.opened,1)
|
||||
|
||||
def testContextManager(self):
|
||||
"""Automatically clean up LAMMPS instance"""
|
||||
with lammps(name=self.machine) as lmp:
|
||||
self.assertIsNot(lmp.lmp,None)
|
||||
self.assertEqual(lmp.opened,1)
|
||||
self.assertEqual(has_mpi and has_mpi4py,lmp.has_mpi4py)
|
||||
self.assertEqual(has_mpi,lmp.has_mpi_support)
|
||||
self.assertIsNone(lmp.lmp,None)
|
||||
self.assertEqual(lmp.opened,0)
|
||||
|
||||
@unittest.skipIf(not (has_mpi and has_mpi4py),"Skipping MPI test since LAMMPS is not parallel or mpi4py is not found")
|
||||
def testWithMPI(self):
|
||||
from mpi4py import MPI
|
||||
@ -78,7 +88,7 @@ class PythonOpen(unittest.TestCase):
|
||||
lmp.close()
|
||||
|
||||
@unittest.skipIf(not has_exceptions,"Skipping death test since LAMMPS isn't compiled with exception support")
|
||||
def testUnknownCommandInList(self):
|
||||
def testUnknownCommandInString(self):
|
||||
lmp = lammps(name=self.machine)
|
||||
|
||||
with self.assertRaisesRegex(Exception, "ERROR: Unknown command: write_paper"):
|
||||
|
||||
Reference in New Issue
Block a user