Skip to content

Commit 93b202a

Browse files
committed
Allow to increase verbosity of test. Correct powder pattern tests to avoid uninitialised observed data which gives warnings in valgrind
1 parent bcf1eba commit 93b202a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

conda-recipe/run_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env python
22

33
import pyobjcryst.tests
4-
assert pyobjcryst.tests.test().wasSuccessful()
4+
assert pyobjcryst.tests.test(verbosity=2).wasSuccessful()

src/pyobjcryst/tests/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ def testsuite(pattern=''):
6363
return suite
6464

6565

66-
def test():
66+
def test(verbosity=1):
6767
'''Execute all unit tests for the pyobjcryst package.
6868
6969
Returns
7070
-------
7171
result : `unittest.TestResult`
7272
'''
7373
suite = testsuite()
74-
runner = unittest.TextTestRunner()
74+
runner = unittest.TextTestRunner(verbosity=verbosity)
7575
result = runner.run(suite)
7676
return result

src/pyobjcryst/tests/testpowderpattern.py

+4
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def test_quick_fit(self):
154154
p.SetWavelength(0.7)
155155
x = np.linspace(0, 40, 8001)
156156
p.SetPowderPatternX(np.deg2rad(x))
157+
p.SetPowderPatternObs(np.ones_like(x))
157158
pd = p.AddPowderPatternDiffraction(c)
158159
pd.SetReflectionProfilePar(ReflectionProfileType.PROFILE_PSEUDO_VOIGT, 1e-6)
159160
# p.plot(hkl=True)
@@ -169,6 +170,7 @@ def test_peaklist_index(self):
169170
p.SetWavelength(0.7)
170171
x = np.linspace(0, 40, 16001)
171172
p.SetPowderPatternX(np.deg2rad(x))
173+
p.SetPowderPatternObs(np.ones_like(x))
172174
pd = p.AddPowderPatternDiffraction(c)
173175
pd.SetReflectionProfilePar(ReflectionProfileType.PROFILE_PSEUDO_VOIGT, 1e-7)
174176
# p.plot(hkl=True)
@@ -194,6 +196,7 @@ def test_spacegroup_explorer(self):
194196
p.SetWavelength(0.7)
195197
x = np.linspace(0, 40, 8001)
196198
p.SetPowderPatternX(np.deg2rad(x))
199+
p.SetPowderPatternObs(np.ones_like(x))
197200
pd = p.AddPowderPatternDiffraction(c)
198201
pd.SetReflectionProfilePar(ReflectionProfileType.PROFILE_PSEUDO_VOIGT, 1e-6, 0, 0, 0, 0)
199202
# p.plot(hkl=True)
@@ -224,6 +227,7 @@ def test_update_nbrefl(self):
224227
p.SetWavelength(1.5)
225228
x = np.linspace(0, 40, 4000)
226229
p.SetPowderPatternX(np.deg2rad(x))
230+
p.SetPowderPatternObs(np.ones_like(x))
227231
pd = p.AddPowderPatternDiffraction(c)
228232
p.GetPowderPatternCalc()
229233
self.assertEqual(pd.GetNbRefl(), 89)

0 commit comments

Comments
 (0)