Skip to content

Commit

Permalink
Devops: Address various deprecation warnings from aiida-core (#979)
Browse files Browse the repository at this point in the history
AiiDA v2.5 upgraded to Sqlalchemy v2 which as of v2.0.19 emits a warning
that is entirely consequential but was too difficult to actually address.
As a workaround, `aiida-core` simply filters the warning. This works for
normal usage, but `pytest` eliminates the filter and so the warnings do
show up in the final warning report of `pytest`. Therefore the warning
has to be explicitly ignored in the `pytest` config as well.
  • Loading branch information
sphuber authored Dec 22, 2023
1 parent e9ce7a0 commit f133b9a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ testpaths = [
'tests',
]
filterwarnings = [
'ignore:Object of type .* not in session, .* operation along .* will not proceed:sqlalchemy.exc.SAWarning',
'ignore:Creating AiiDA configuration folder.*:UserWarning',
'ignore::DeprecationWarning:frozendict:',
'ignore::DeprecationWarning:pkg_resources:',
Expand Down
2 changes: 1 addition & 1 deletion src/aiida_quantumespresso/workflows/xps.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
PwCalculation = CalculationFactory('quantumespresso.pw')
PwBaseWorkChain = WorkflowFactory('quantumespresso.pw.base')
PwRelaxWorkChain = WorkflowFactory('quantumespresso.pw.relax')
XyData = DataFactory('array.xy')
XyData = DataFactory('core.array.xy')


def validate_inputs(inputs, _):
Expand Down
2 changes: 1 addition & 1 deletion src/aiida_quantumespresso/workflows/xspectra/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def define(cls, spec):
)
spec.input(
'upf2plotcore_code',
valid_type=orm.Code,
valid_type=orm.AbstractCode,
required=False,
help='The code node required for upf2plotcore.sh configured for ``aiida-shell``. '
'Must be provided if `core_wfc_data` is not provided.'
Expand Down
4 changes: 2 additions & 2 deletions src/aiida_quantumespresso/workflows/xspectra/crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
PwRelaxWorkChain = WorkflowFactory('quantumespresso.pw.relax')
XspectraBaseWorkChain = WorkflowFactory('quantumespresso.xspectra.base')
XspectraCoreWorkChain = WorkflowFactory('quantumespresso.xspectra.core')
XyData = DataFactory('array.xy')
XyData = DataFactory('core.array.xy')


class XspectraCrystalWorkChain(ProtocolMixin, WorkChain):
Expand Down Expand Up @@ -128,7 +128,7 @@ def define(cls, spec):
)
spec.input(
'upf2plotcore_code',
valid_type=orm.Code,
valid_type=orm.AbstractCode,
required=False,
help=(
'Code node for the upf2plotcore.sh ShellJob code.'
Expand Down
4 changes: 2 additions & 2 deletions tests/parsers/test_neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_neb_default(fixture_localhost, generate_calc_job_node, generate_parser,

assert calcfunction.is_finished, calcfunction.exception
assert calcfunction.is_finished_ok, calcfunction.exit_message
assert not [log for log in orm.Log.objects.get_logs_for(node) if log.levelname == 'ERROR']
assert not [log for log in orm.Log.collection.get_logs_for(node) if log.levelname == 'ERROR']
assert 'output_parameters' in results
assert 'output_mep' in results
assert 'output_trajectory' in results
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_neb_all_iterations(

assert calcfunction.is_finished, calcfunction.exception
assert calcfunction.is_finished_ok, calcfunction.exit_message
assert not [log for log in orm.Log.objects.get_logs_for(node) if log.levelname == 'ERROR']
assert not [log for log in orm.Log.collection.get_logs_for(node) if log.levelname == 'ERROR']
assert 'output_parameters' in results
assert 'output_mep' in results
assert 'output_trajectory' in results
Expand Down
4 changes: 2 additions & 2 deletions tests/parsers/test_open_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def test_open_grid_default(fixture_localhost, generate_calc_job_node, generate_p

data_regression.check({
'output_parameters': results['output_parameters'].get_dict(),
'kpoints_mesh': results['kpoints_mesh'].attributes,
'kpoints': results['kpoints'].attributes,
'kpoints_mesh': results['kpoints_mesh'].base.attributes.all,
'kpoints': results['kpoints'].base.attributes.all,
})

num_regression.check({
Expand Down
2 changes: 1 addition & 1 deletion tests/parsers/test_ph.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_ph_default(test_name, fixture_localhost, generate_calc_job_node, genera

assert calcfunction.is_finished, calcfunction.exception
assert calcfunction.is_finished_ok, calcfunction.exit_message
assert not [log for log in orm.Log.objects.get_logs_for(node) if log.levelname == 'ERROR']
assert not [log for log in orm.Log.collection.get_logs_for(node) if log.levelname == 'ERROR']
assert 'output_parameters' in results
data_regression.check(results['output_parameters'].get_dict())

Expand Down

0 comments on commit f133b9a

Please sign in to comment.