Skip to content

Commit 90ec1f9

Browse files
author
jngaravitoc
committed
updating test files
1 parent 30eb116 commit 90ec1f9

4 files changed

Lines changed: 445 additions & 319 deletions

File tree

tests/conftest.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import numpy as np
2+
import pytest
3+
import os
4+
5+
try:
6+
from mpi4py import MPI
7+
MPI_AVAILABLE = True
8+
except ImportError:
9+
MPI_AVAILABLE = False
10+
11+
12+
@pytest.fixture(scope="session")
13+
def particle_data():
14+
"""
15+
Load particle data from ASCII file.
16+
17+
Expected format:
18+
x y z mass
19+
"""
20+
data = np.loadtxt(
21+
os.path.join(os.path.dirname(__file__), "data", "particle_data.txt")
22+
)
23+
24+
pos = data[:, 0:3]
25+
mass = data[:, 3]
26+
27+
return {
28+
"pos": pos,
29+
"mass": mass,
30+
"snapshot_time": 0.0,
31+
}
32+
33+
34+
@pytest.fixture(scope="session")
35+
def reference_coefs_file():
36+
return os.path.join(
37+
os.path.dirname(__file__), "data", "coef_test.hdf5"
38+
)
39+
40+
41+
@pytest.fixture(scope="session")
42+
def mpi_comm():
43+
if not MPI_AVAILABLE:
44+
pytest.skip("mpi4py not available")
45+
46+
return MPI.COMM_WORLD
47+

0 commit comments

Comments
 (0)