-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Problem
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,
def test_pickling():
"""Test pickling of DiffpyStructureParSet."""
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels