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

Improve context storage to share data through whole run #395

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 5 additions & 3 deletions toolium/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""

import base64
import collections
import datetime
import json
import logging
Expand Down Expand Up @@ -684,8 +683,11 @@ def _get_initial_value_from_context(initial_key, context):
"""
context_storage = context.storage if hasattr(context, 'storage') else {}
if hasattr(context, 'feature_storage'):
# context.feature_storage is initialized only when before_feature method is called
context_storage = collections.ChainMap(context.storage, context.feature_storage)
# Merge feature to storage, context.feature_storage is initialized only when before_feature method is called
context_storage.update(context.feature_storage)
if hasattr(context, 'run_storage'):
# Merge run to storage, context.run_storage is initialized only when before_all method is called
context_storage.update(context.run_storage)
if initial_key in context_storage:
value = context_storage[initial_key]
elif hasattr(context, initial_key):
Expand Down
Loading