Closed
Description
Problem
Running pytest for diffpy.pdfmorph
in the main branch.
FAILED tests/test_pdfmorphapp.py::TestApp::test_parser_systemexits - AttributeError: module 'diffpy.utils.parsers' has no attribute 'loaddata'
FAILED tests/test_pdfmorphapp.py::TestApp::test_morphsequence - AttributeError: module 'diffpy.utils.parsers' has no attribute 'loaddata'
FAILED tests/test_pdfmorphio.py::TestApp::test_morph_outputs - AttributeError: module 'diffpy.utils.parsers' has no attribute 'loaddata'
FAILED tests/test_tools.py::TestTools::test_field_sort - AttributeError: module 'diffpy.utils.parsers' has no attribute 'loaddata'
It comes from diffpy.pdfmorph
tools.py
import diffpy.utils.parsers as parsers
# ...
rv = parsers.loaddata.loadData(fname, unpack=True)
The problem is related to diffpy.utils
's sub-package parsers
. Old parser
is reconstructed as a sub-package and loaddata
is a module now.
Proposed solution
A similar structure found in other projects under diffpy
.
e.g. for diffpy.pdfmorph
's sub-package morph
. The problem is avoided by importing the package's modules in its __init__.py
.
from diffpy.pdfmorph.morphs.morph import Morph # noqa: F401
from diffpy.pdfmorph.morphs.morphchain import MorphChain # noqa: F401
# ...
Mirroring this method may solve the problem
Metadata
Metadata
Assignees
Labels
No labels