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

Fix calculate check2 #1

Closed
wants to merge 11 commits into from
Closed

Fix calculate check2 #1

wants to merge 11 commits into from

Conversation

juraskov
Copy link
Owner

@juraskov juraskov commented Nov 2, 2024

PR to view changes between branches, no to merge

Comment on lines +117 to +118
Config.orca_keywords = ['PBE', 'def2-SVP', 'EnGrad']
Config.gaussian_keywords = ['B3LYP', '6-31G(d)', 'Force']
Copy link

@danielhollas danielhollas Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Config.orca_keywords = ['PBE', 'def2-SVP', 'EnGrad']
Config.gaussian_keywords = ['B3LYP', '6-31G(d)', 'Force']
gauss_kws = Config.gaussian_keywords
orca_kws = Config.orca_keywords
Config.orca_keywords = ['PBE', 'def2-SVP', 'EnGrad']
Config.gaussian_keywords = ['B3LYP', '6-31G(d)', 'Force']
yield
Config.gaussian_keywords = gauss_kws
Config.orca_keywords = orca_kws

https://docs.pytest.org/en/latest/how-to/fixtures.html#teardown-cleanup-aka-fixture-finalization


def test_gaussian_keywords_no_config():
"""Test _gaussian_keywords raises ValueError when Gaussian keywords are not set"""
Config.gaussian_keywords = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is now None so we should not set it here

Suggested change
Config.gaussian_keywords = None


def test_orca_keywords_no_config():
"""Test _orca_keywords raises ValueError when ORCA keywords are not set"""
Config.orca_keywords = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Config.orca_keywords = None

run_autode(configuration, method_name='mock_method', n_cores=1)

captured = capsys.readouterr()
assert 'Failed to calculate the energy' in captured.out

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert 'Failed to calculate the energy' in captured.out
assert 'Failed to calculate the energy' in captured.err

def test_orca_keywords_success(set_config):
"""Test _orca_keywords retrieves the ORCA keywords from Config"""
keywords = _orca_keywords()
assert keywords == Config.orca_keywords

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it still fail if you try this?

Suggested change
assert keywords == Config.orca_keywords
assert keywords._list == Config.orca_keywords._list

_method_and_keywords('invalid_method')


def test_orca_keywords_success(set_config):
Copy link

@danielhollas danielhollas Nov 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_orca_keywords_success(set_config):
@pytest.mark.xfail
def test_orca_keywords_success(set_config):

@juraskov juraskov closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants