def test_run__order(): cfg_mock = Mock(temp_root=_DUMMY_TEMP_ROOT) node_mock = Mock() node = Node() node._create_temp_dir = node_mock._create_temp_dir node._create_temp_dir.return_value = _DUMMY_TEMP node._setup = node_mock._setup node._run = node_mock._run node._teardown = node_mock._teardown node._remove_temp_dir = node_mock._remove_temp_dir node.run(cfg_mock) node_mock.mock_calls == [ call._create_temp_dir(cfg_mock), call._setup(cfg_mock, _DUMMY_TEMP), call._run(cfg_mock, _DUMMY_TEMP), call._teardown(cfg_mock, _DUMMY_TEMP), call._remove_temp_dir(_DUMMY_TEMP), ]
def _teardown(self, config, temp): output_file, = self.output_files temp_file = os.path.join(temp, os.path.basename(output_file)) fileutils.move_file(temp_file, output_file) Node._teardown(self, config, temp)
def test__teardown__output_files_missing(): node = Node(input_files=_EMPTY_FILE, output_files=_OUT_FILES) with pytest.raises(NodeError): node._teardown(None, None)