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

Make sure that datetime conversions ignore None #3628

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

giovannipizzi
Copy link
Member

The functions datetime_to_isoformat and isoformat_to_datetime
assumed to always have a proper type (string or datetime) as input.
However, in some cases, they were called with values that could
be potentially None, like this in aiida/engine/utils.py:

timezone.isoformat_to_datetime(manager.get(key).value))

We are now directly returning None if None is passed as an
input (and then it's up to the caller to then decide what to do
with the value.

Fixes #3336

The functions `datetime_to_isoformat` and `isoformat_to_datetime`
assumed to always have a proper type (string or datetime) as input.
However, in some cases, they were called with values that could
be potentially `None`, like this in aiida/engine/utils.py:
```
timezone.isoformat_to_datetime(manager.get(key).value))
```
We are now directly returning `None` if `None` is passed as an
input (and then it's up to the caller to then decide what to do
with the value.

Fixes aiidateam#3336
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

@sphuber sphuber merged commit f66d0a6 into aiidateam:develop Dec 10, 2019
@greschd
Copy link
Member

greschd commented Dec 10, 2019

Possibly related test failure? https://github.com/aiidateam/aiida-core/pull/3637/checks?check_run_id=342693485

EDIT: same problem, different code part.

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.

Randomly failing test (test_list_worker_slot_warning)
3 participants