MT refactor test_jobs

Bug #925990 reported by Giuseppe Vallarelli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake (deprecated)
Fix Released
Medium
Giuseppe Vallarelli

Bug Description

[et=3]
[at=4]
In test_job there are some function that depend on two external objects: context, workflow, as well as ugly test_parameters_X_job. The aim of the refactoring is to:

1. Get rid of these dependencies by storing tests input data in external files, so each test function depend only on the called job code.

2. Refactor test_parameters using mock library an example of refactoring for tests_parameters_gardner_knopoff could be:

def test_parameters_gardner(self):
        context = create_context('config_gardner_knopoff.yml')
        context.working_catalog = []

        mocked_func = Mock(return_value=([], [], []))
        context.map_sc['gardner_knopoff'] = mocked_func

        gardner_knopoff(context)

        self.assertTrue(mocked_func.called)
        mocked_func.assert_called_with([], 'GardnerKnopoff', 0.5)

description: updated
description: updated
Changed in openquake:
status: New → In Progress
Changed in openquake:
status: In Progress → Fix Committed
description: updated
Changed in openquake:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.