Skip to content

Commit 4703f0d

Browse files
committed
Close LAMMPS instance in tests
1 parent b1c83e7 commit 4703f0d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

tests/test_ase_interface.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def test_small_displacement(self):
123123
self.assertTrue(
124124
np.all(np.isclose(lmp.interactive_positions_getter(), positions))
125125
)
126+
lmp.close()
126127

127128
def test_velocities(self):
128129
lmp = LammpsASELibrary(
@@ -174,6 +175,7 @@ def test_velocities(self):
174175
self.assertTrue(
175176
np.all(np.isclose(lmp.interactive_positions_getter(), positions))
176177
)
178+
lmp.close()
177179

178180
def test_small_displacement_skewed(self):
179181
lmp = LammpsASELibrary(
@@ -218,6 +220,7 @@ def test_small_displacement_skewed(self):
218220
self.assertTrue(
219221
np.all(np.isclose(lmp.interactive_positions_getter(), positions))
220222
)
223+
lmp.close()
221224

222225
def test_static_with_statement(self):
223226
structure = bulk("Al").repeat([2, 2, 2])

tests/test_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def test_file_not_found(self):
3636
)
3737
with self.assertRaises(FileNotFoundError):
3838
lmp.file("file_does_not_exist.txt")
39+
lmp.close()
3940

4041
def test_extract_atom(self):
4142
f = self.lmp.extract_atom("f")

tests/test_exception.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_overlapping_atoms(self):
4949
with self.assertRaises(Exception):
5050
lmp = LammpsLibrary(cores=2)
5151
lmp.file("in.error")
52+
lmp.close()
5253

5354
def tearDown(self):
5455
for f in ["in.error", "log.lammps"]:

0 commit comments

Comments
 (0)