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

Control max_spiral_loops via YAML test files #985

Merged
merged 5 commits into from
Mar 26, 2021
Merged
Changes from 3 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
6 changes: 5 additions & 1 deletion openfisca_core/tools/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def import_yaml():
return yaml, Loader


TEST_KEYWORDS = {'absolute_error_margin', 'description', 'extensions', 'ignore_variables', 'input', 'keywords', 'name', 'only_variables', 'output', 'period', 'reforms', 'relative_error_margin'}
TEST_KEYWORDS = {'absolute_error_margin', 'description', 'extensions', 'ignore_variables', 'input', 'keywords', 'max_spiral_loops', 'name', 'only_variables', 'output', 'period', 'reforms', 'relative_error_margin'}

yaml, Loader = import_yaml()

Expand Down Expand Up @@ -142,6 +142,7 @@ def runtest(self):
builder = SimulationBuilder()
input = self.test.get('input', {})
period = self.test.get('period')
max_spiral_loops = self.test.get('max_spiral_loops')
verbose = self.options.get('verbose')
performance_graph = self.options.get('performance_graph')
performance_tables = self.options.get('performance_tables')
Expand All @@ -155,6 +156,9 @@ def runtest(self):
error_message = os.linesep.join([str(e), '', f"Unexpected error raised while parsing '{self.fspath}'"])
raise ValueError(error_message).with_traceback(sys.exc_info()[2]) from e # Keep the stack trace from the root error

if max_spiral_loops:
self.simulation.max_spiral_loops = max_spiral_loops

try:
self.simulation.trace = verbose or performance_graph or performance_tables
self.check_output()
Expand Down