Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests point to abs path instead of relative #4

Open
JosePizarro3 opened this issue Apr 24, 2024 · 1 comment
Open

Tests point to abs path instead of relative #4

JosePizarro3 opened this issue Apr 24, 2024 · 1 comment
Labels
question Further information is requested

Comments

@JosePizarro3
Copy link

I think some configuration of the tests is wrong. The test should be testing the parse() function of the class itself, without the need to import nomad.client import parse function. I think this client function works matching the parser, or is it implemented such that any parser plugin will be recognized? Also, how optimized this matching would be w.r.t to simply test the class parse() function?

Furthermore, doing this nomad.client.parse creates the need of pointing to the abs path of the tests/data folder, instead of using the relative path. In other words, right now the test config is:

from nomad.client import parse


def test_parser():
    test_file = os.path.join(os.path.dirname(__file__), 'data', 'test.example-format.txt')
    entry_archive = parse(test_file)

but it should be:

from nomadparserexample import ExampleParser


@pytest.fixture(scope='module')
def parser():
    return ExampleParser()


def test_band(parser):
    archive = EntryArchive()
    parser.parse('tests/data/test.example-format.txt', archive, None)
@JosePizarro3 JosePizarro3 added the question Further information is requested label Apr 24, 2024
@JosePizarro3
Copy link
Author

@ladinesa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant