You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: remove pytest.skip when a package is not installed #152
Some of these older tests skip pytest if a package is not imported into the developer's environment. This looks something like the following,
def test_pickling(diffpy_structure_available):
"""Test pickling of DiffpyStructureParSet."""
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Atom, Structure
stru = Structure([Atom("C", [0, 0.2, 0.5])])
dsps = DiffpyStructureParSet("dsps", stru)
data = pickle.dumps(dsps)
dsps2 = pickle.loads(data)
assert 1 == len(dsps2.atoms)
assert 0.2 == dsps2.atoms[0].y.value
return
This is not the best behavior. If the developer doesnt have this package installed into their environment, this test should fail and they should install the necessary package.
Proposed solution
Remove the if not <package_name>: conditional and its associated fixture(s) in conftest.py. The test should then look something like this,
I think we can remove that, especially since diffpy.structure is part of the core. But I guess there is a question in general about how we test packs. If we test all the packs we will run into problems if a pack is not maintained, but if we don't test packs then we aren't testing all our functionality. Do you have thoughts on this?
Activity
cadenmyers13 commentedon Feb 9, 2026
@sbillinge Do you know/remember if this
pytest.skipwas implemented for any reason? if not, we can proceed with this.sbillinge commentedon Feb 10, 2026
I think we can remove that, especially since
diffpy.structureis part of the core. But I guess there is a question in general about how we test packs. If we test all the packs we will run into problems if a pack is not maintained, but if we don't test packs then we aren't testing all our functionality. Do you have thoughts on this?