-
Notifications
You must be signed in to change notification settings - Fork 1
/
conftest.py
71 lines (57 loc) · 1.78 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""pytest fixtures for simplified testing."""
# pylint: disable=redefined-outer-name
import pytest
from aiida import orm
from tests import DATA_DIR
pytest_plugins = [
"aiida.manage.tests.pytest_fixtures",
] # pylint: disable=invalid-name
@pytest.fixture(scope="function", autouse=True)
def clear_database_auto(clear_database): # pylint: disable=unused-argument
"""Automatically clear database in between tests."""
@pytest.fixture(scope="function")
def data_dir(): # pylint: disable=unused-argument
"""Directory for tests data."""
return DATA_DIR
# @pytest.fixture(scope="function")
# def nwchem_code(aiida_local_code_factory):
# """Get a nwchem code."""
# code = aiida_local_code_factory(executable="nwchem", entry_point="nwchem.base")
# return code
@pytest.fixture(scope="function")
def nwchem_code(mock_code_factory):
"""Create mocked "nwchem" code."""
return mock_code_factory(
label="nwchem-7.1",
data_dir_abspath=DATA_DIR,
entry_point="nwchem.base",
# hasher=CustomInputHasher,
# files *not* to copy into the data directory
ignore_paths=("_aiidasubmit.sh", "*.movecs", "*.gridpts.*", "*.db"),
)
@pytest.fixture(scope="function")
def h2o_structure_data():
"""Get a H2O structuredata."""
alat = 4.0 # angstrom
cell = [
[
alat,
0.0,
0.0,
],
[
0.0,
alat,
0.0,
],
[
0.0,
0.0,
alat,
],
]
s = orm.StructureData(cell=cell)
s.append_atom(position=(0.0, 0.0, 0.0), symbols=["O"])
s.append_atom(position=(0.0, 1.43042809, -1.10715266), symbols=["H"])
s.append_atom(position=(0.0, -1.43042809, -1.10715266), symbols=["H"])
return s