Skip to content

Commit

Permalink
🐛 FIX: Initialising a Node with a User (#4977)
Browse files Browse the repository at this point in the history
The `Node` constructor allows for a specific user to be set other
than the current default, except this wasn't actually working. The bug
has been fixed and a test added.

Cherry-pick: f4f543c
  • Loading branch information
chrisjsewell authored and sphuber committed Aug 8, 2021
1 parent a3efc53 commit 4dccd5f
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 134 deletions.
7 changes: 7 additions & 0 deletions aiida/manage/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def clear_database_before_test(aiida_profile):
yield


@pytest.fixture(scope='class')
def clear_database_before_test_class(aiida_profile):
"""Clear the database before a test class."""
aiida_profile.reset_db()
yield


@pytest.fixture(scope='function')
def temporary_event_loop():
"""Create a temporary loop for independent test case"""
Expand Down
2 changes: 1 addition & 1 deletion aiida/orm/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def __init__(
raise ValueError('the computer is not stored')

computer = computer.backend_entity if computer else None
user = user.backend_entity if user else User.objects(backend).get_default()
user = user if user else User.objects(backend).get_default()

if user is None:
raise ValueError('the user cannot be None')
Expand Down
Loading

0 comments on commit 4dccd5f

Please sign in to comment.