Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/fix-test-package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Added `diffpy.structure` back to the requirements and run the test

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
1 change: 1 addition & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ numpy
scipy
bg-mpl-stylesheets
diffpy.utils
diffpy.structure
1 change: 1 addition & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ numpy
scipy
bg-mpl-stylesheets
diffpy.utils
diffpy.structure
3 changes: 3 additions & 0 deletions src/diffpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
# See LICENSE.rst for license information.
#
##############################################################################
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
5 changes: 0 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ def sas_available():
return has_sas()


@pytest.fixture(scope="session")
def diffpy_structure_available():
return has_diffpy_structure()


@pytest.fixture(scope="session")
def diffpy_srreal_available():
return has_diffpy_srreal()
Expand Down
13 changes: 3 additions & 10 deletions tests/test_diffpyparset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
import unittest

import numpy as np
import pytest

from diffpy.srfit.structure.diffpyparset import DiffpyStructureParSet


def testDiffpyStructureParSet(diffpy_structure_available):
def testDiffpyStructureParSet():
"""Test the structure conversion."""
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Atom, Lattice, Structure

a1 = Atom("Cu", xyz=np.array([0.0, 0.1, 0.2]), Uisoequiv=0.003)
Expand Down Expand Up @@ -103,10 +100,8 @@ def _testLattice():
return


def test___repr__(diffpy_structure_available):
def test___repr__():
"""Test representation of DiffpyStructureParSet objects."""
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Atom, Lattice, Structure

lat = Lattice(3, 3, 2, 90, 90, 90)
Expand All @@ -119,10 +114,8 @@ def test___repr__(diffpy_structure_available):
return


def test_pickling(diffpy_structure_available):
def test_pickling():
"""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])])
Expand Down
28 changes: 6 additions & 22 deletions tests/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ def testParser2(datafile):
return


def testGenerator(
diffpy_srreal_available, diffpy_structure_available, datafile
):
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
def testGenerator(diffpy_srreal_available, datafile):
if not diffpy_srreal_available:
pytest.skip("diffpy.srreal package not available")

Expand Down Expand Up @@ -200,7 +196,7 @@ def testGenerator(
return


def test_setQmin(diffpy_structure_available, diffpy_srreal_available):
def test_setQmin(diffpy_srreal_available):
"""Verify qmin is propagated to the calculator object."""
if not diffpy_srreal_available:
pytest.skip("diffpy.srreal package not available")
Expand All @@ -214,10 +210,8 @@ def test_setQmin(diffpy_structure_available, diffpy_srreal_available):
return


def test_setQmax(diffpy_structure_available, diffpy_srreal_available):
def test_setQmax(diffpy_srreal_available):
"""Check PDFContribution.setQmax()"""
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Structure

if not diffpy_srreal_available:
Expand All @@ -233,10 +227,8 @@ def test_setQmax(diffpy_structure_available, diffpy_srreal_available):
return


def test_getQmax(diffpy_structure_available, diffpy_srreal_available):
def test_getQmax(diffpy_srreal_available):
"""Check PDFContribution.getQmax()"""
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Structure

if not diffpy_srreal_available:
Expand All @@ -260,12 +252,8 @@ def test_getQmax(diffpy_structure_available, diffpy_srreal_available):
return


def test_savetxt(
diffpy_structure_available, diffpy_srreal_available, datafile
):
def test_savetxt(diffpy_srreal_available, datafile):
"check PDFContribution.savetxt()"
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import Structure

if not diffpy_srreal_available:
Expand All @@ -286,12 +274,8 @@ def test_savetxt(
return


def test_pickling(
diffpy_structure_available, diffpy_srreal_available, datafile
):
def test_pickling(diffpy_srreal_available, datafile):
"validate PDFContribution.residual() after pickling."
if not diffpy_structure_available:
pytest.skip("diffpy.structure package not available")
from diffpy.structure import loadStructure

if not diffpy_srreal_available:
Expand Down
Loading