Skip to content

Commit

Permalink
TST: Use absolute path names for example data files
Browse files Browse the repository at this point in the history
  • Loading branch information
pastewka committed Jan 4, 2024
1 parent cf9041c commit 24c9a23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tests/test_bop.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import os.path

import numpy as np

import pytest
Expand Down Expand Up @@ -71,7 +73,7 @@ def test_stress(a0, par):

def test_hessian_divide_by_masses():
# Test the computation of dynamical matrix
atoms = ase.io.read('aSi.cfg')
atoms = ase.io.read(f'{os.path.dirname(__file__)}/aSi.cfg')
masses_n = np.random.randint(1, 10, size=len(atoms))
atoms.set_masses(masses=masses_n)
kumagai_potential = kumagai.Kumagai_Comp_Mat_Sci_39_Si
Expand Down
7 changes: 4 additions & 3 deletions tests/test_neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ======================================================================

import os.path
import unittest

import numpy as np
Expand Down Expand Up @@ -70,7 +71,7 @@ class TestNeighbours(matscipytest.MatSciPyTestCase):

def test_neighbour_list(self):
for pbc in [True, False, [True, False, True]]:
a = io.read('aC.cfg')
a = io.read(f'{os.path.dirname(__file__)}/aC.cfg')
a.set_pbc(pbc)
j, dr, i, abs_dr, shift = neighbour_list("jDidS", a, 1.85)

Expand All @@ -90,7 +91,7 @@ def test_neighbour_list(self):

def test_neighbour_list_atoms_outside_box(self):
for pbc in [True, False, [True, False, True]]:
a = io.read('aC.cfg')
a = io.read(f'{os.path.dirname(__file__)}/aC.cfg')
a.set_pbc(pbc)
a.positions[100, :] += a.cell[0, :]
a.positions[200, :] += a.cell[1, :]
Expand Down Expand Up @@ -243,7 +244,7 @@ def test_wrong_number_of_cutoffs(self):
self.assertTrue(exception_thrown)

def test_shrink_wrapped_direct_call(self):
a = io.read('aC.cfg')
a = io.read(f'{os.path.dirname(__file__)}/aC.cfg')
r = a.positions
j, dr, i, abs_dr, shift = neighbour_list("jDidS", positions=r,
cutoff=1.85)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_ring_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ======================================================================

import os.path
import unittest

import numpy as np
Expand Down Expand Up @@ -102,7 +103,7 @@ def test_pbc(self):
self.assertEqual(len(r), 0)

def test_aC(self):
a = ase.io.read('aC.cfg')
a = ase.io.read(f'{os.path.dirname(__file__)}/aC.cfg')
r = ring_statistics(a, 1.85, maxlength=16)
self.assertArrayAlmostEqual(r, [0,0,0,0,4,813,2678,1917,693,412,209,89,
21,3])
Expand Down

0 comments on commit 24c9a23

Please sign in to comment.