Skip to content

Commit c14681f

Browse files
committed
pytest add flag -p no:warnings in setup.cfg
1 parent bb36fff commit c14681f

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

atomate/vasp/workflows/tests/test_bulk_modulus_workflow.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
DEBUG_MODE = False
2323
# If None, runs a "fake" VASP. Otherwise, runs VASP with this command...
2424
VASP_CMD = None
25-
_write_task_docs = (
26-
False # Test developer option: defaults to False, need to be True only once
27-
)
25+
# Test developer option: defaults to False, need to be True only once
26+
_write_task_docs = False
2827

2928

3029
class TestBulkModulusWorkflow(AtomateTest):
@@ -44,18 +43,18 @@ class TestBulkModulusWorkflow(AtomateTest):
4443
def setUp(self):
4544
super().setUp()
4645
self.struct_si = PymatgenTest.get_structure("Si")
47-
self.ndeformations = 6
46+
self.n_deformations = 6
4847
self.deformations = [
4948
(np.identity(3) * (1 + x)).tolist()
50-
for x in np.linspace(-0.05, 0.05, self.ndeformations)
49+
for x in np.linspace(-0.05, 0.05, self.n_deformations)
5150
]
5251
self.wf_config = {"VASP_CMD": ">>vasp_cmd<<", "DB_FILE": ">>db_file<<"}
5352
self.wf = wf_bulk_modulus(self.struct_si, self.wf_config)
5453

5554
def _simulate_vasprun(self, wf):
5655
no_vasp_ref_dirs = {}
5756
fake_vasp_ref_dirs = {}
58-
for i in range(2, self.ndeformations + 2):
57+
for i in range(2, self.n_deformations + 2):
5958
if os.path.exists(os.path.join(reference_dir, str(i), "inputs")):
6059
if not VASP_CMD:
6160
fake_vasp_ref_dirs[
@@ -119,16 +118,16 @@ def _check_run(self, d, mode):
119118
elif mode in ["fit equation of state"]:
120119
self.assertAlmostEqual(d["bulk_modulus"], 88.90, places=2)
121120
self.assertEqual(len(d["all_task_ids"]), 7)
122-
self.assertEqual(len(d["energies"]), self.ndeformations)
123-
self.assertEqual(len(d["volumes"]), self.ndeformations)
121+
self.assertEqual(len(d["energies"]), self.n_deformations)
122+
self.assertEqual(len(d["volumes"]), self.n_deformations)
124123
s = SpacegroupAnalyzer(
125124
Structure.from_dict(d["structure"])
126125
).get_conventional_standard_structure()
127126
self.assertAlmostEqual(s.lattice.c, 5.468, places=3)
128127

129128
def setup_task_docs(self):
130129
self.task_file = "task.json"
131-
for i in range(2, self.ndeformations + 2):
130+
for i in range(2, self.n_deformations + 2):
132131
if os.path.exists(os.path.join(reference_dir, str(i), self.task_file)):
133132
with open(os.path.join(reference_dir, str(i), self.task_file)) as fp:
134133
d = json.load(fp)
@@ -161,7 +160,7 @@ def setup_task_docs(self):
161160

162161
def write_task_docs(self):
163162
# this step needs to be run once: once task.json is present, remove the inputs/outputs folders
164-
for i in range(2, self.ndeformations + 2):
163+
for i in range(2, self.n_deformations + 2):
165164
# not to unnecessarily override available task.json
166165
if not os.path.exists(os.path.join(reference_dir, str(i), "task.json")):
167166
d = self.get_task_collection().find_one(
@@ -186,7 +185,7 @@ def write_task_docs(self):
186185

187186
def test_wf(self):
188187
self.wf = self._simulate_vasprun(self.wf)
189-
self.assertEqual(len(self.wf.fws), self.ndeformations + 2)
188+
self.assertEqual(len(self.wf.fws), self.n_deformations + 2)
190189

191190
defo_vis = [
192191
fw.tasks[2]["vasp_input_set"] for fw in self.wf.fws if "deform" in fw.name

atomate/vasp/workflows/tests/test_nmr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
DEBUG_MODE = False
1919
# If None, runs a "fake" VASP. Otherwise, runs VASP with this command...
2020
VASP_CMD = None
21-
_write_task_docs = (
22-
False # Test developer option: defaults to False, need to be True only once
23-
)
21+
# Test developer option: defaults to False, need to be True only once
22+
_write_task_docs = False
2423

2524

2625
class TestNMRWorkflow(AtomateTest):

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ per-file-ignores =
2323
profile = black
2424

2525
[tool:pytest]
26-
addopts = --ignore=atomate/qchem/test_files
26+
addopts = --ignore=atomate/qchem/test_files -p no:warnings
2727

2828
[codespell]
2929
ignore-words-list = mater,nin

0 commit comments

Comments
 (0)