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

Now skips tests with QE if PWSCF_COMMAND is not found #48

Merged
merged 1 commit into from
Sep 14, 2019
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
12 changes: 10 additions & 2 deletions tests/test_OTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def cleanup_espresso_run(target: str = None):
# ------------------------------------------------------
# test otf runs
# ------------------------------------------------------

@pytest.mark.skipif(not os.environ.get('PWSCF_COMMAND',
False), reason='PWSCF_COMMAND not found '
'in environment: Please install Quantum '
'ESPRESSO and set the PWSCF_COMMAND env. '
'variable to point to pw.x.')
def test_otf_h2():
"""
Test that an otf run can survive going for more steps
Expand Down Expand Up @@ -63,7 +67,11 @@ def test_otf_h2():
os.system('mv h2_otf.out test_outputs')
cleanup_espresso_run()


@pytest.mark.skipif(not os.environ.get('PWSCF_COMMAND',
False), reason='PWSCF_COMMAND not found '
'in environment: Please install Quantum '
'ESPRESSO and set the PWSCF_COMMAND env. '
'variable to point to pw.x.')
def test_otf_al():
"""
Test that an otf run can survive going for more steps
Expand Down
13 changes: 7 additions & 6 deletions tests/test_qe_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import os
import sys
import numpy as np
from flare import struc
from flare.struc import Structure
from flare.struc import Structure, get_unique_species
from flare.qe_util import parse_qe_input, parse_qe_forces, run_espresso, \
edit_qe_input_positions, qe_input_to_structure

Expand Down Expand Up @@ -77,10 +76,12 @@ def test_input_to_structure(qe_input):
'./test_files/qe_output_1.out')
]
)
@pytest.mark.skipif(not os.environ.get('PWSCF_COMMAND',
False), reason='PWSCF_COMMAND not found '
'in environment: Please install Quantum '
'ESPRESSO and set the PWSCF_COMMAND env. '
'variable to point to pw.x.')
def test_espresso_calling(qe_input, qe_output):
assert os.environ.get('PWSCF_COMMAND',
False), 'PWSCF_COMMAND not found ' \
'in environment'

pw_loc = os.environ.get('PWSCF_COMMAND')
os.system(' '.join(['cp', qe_input, 'pwscf.in']))
Expand Down Expand Up @@ -111,7 +112,7 @@ def test_espresso_input_edit():
"""
os.system('cp test_files/qe_input_1.in .')
positions, species, cell, masses = parse_qe_input('./qe_input_1.in')
_, coded_species = struc.get_unique_species(species)
_, coded_species = get_unique_species(species)
structure = Structure(cell, coded_species, positions, masses,
species_labels=species)

Expand Down