Skip to content

fix: compatibility with new diffpy.utils.parsers API #161

Closed
@ycexiao

Description

@ycexiao

Problem

Running pytest in the main branch with latest diffpy.utils

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 lines like this

import diffpy.utils.parsers as parsers 
# ...
rv = parsers.loaddata.loadData(fname, unpack=True) 

Proposed solution

Adding addtional import path when importing

import diffpy.utils.parsers as parsers 
import diffpy.utils.parsers.loaddata
# ...
rv = parsers.loaddata.loadData(fname, unpack=True) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions