Is it possible to execute finalizer fixture in python only after all parameters of the test are executed?
<p>I am trying to execute a finalizer fixture after all parameters of my test case ran. The problem is my finalizer is getting executed after every parameter run so the values that i need are getting reset. Example:</p>

<pre><code>@pytest.mark.parametrize('testcaseid',
                         ['1', '2', '3'])
@pytest.mark.parametrize('lang',
                         ["EN",
                          "FR"])
def test_lang(self, request, base_url, lang, testcaseid, connect_testrail):
    try:
        base_url = base_url.replace("english", "french") if lang == "FR" else base_url
        self.navigate(base_url)
        self.wait_for_page_loaded()
        result = self.check_correct_lang_displayed()

        assert result
        connect_testrail.add_to_result(testcaseid, result="Passed", cmnt=lang)
    except Exception as e:
        connect_testrail.add_to_result(testcaseid, result="Failed", cmnt=lang + ". Error: " + str(e))
        pytest.fail(str(e))
</code></pre>

<p>my add_to_result function in a separate class is as follows:</p>

<pre><code>    def add_to_result(self, case_id, result="Untested", cmnt='None'):
    self.testcase.setdefault(case_id, [])
    self.testcase[case_id].append(result)
    self.testcase[case_id].append(cmnt)
</code></pre>

<p>my teardown finalizer in the conftest file is this:</p>

<pre><code>@pytest.fixture(scope='function', autouse=True)
def update_test_case_status(request):
    logging.info("Starting Test case...")

    def update_at_the_end():
        logging.info("Ending Test Case...")
        results = test_results()
        for values in results.itervalues():
            if "Failed" in values[0]:
                test_rail_conn.update_test_status(test_result="Failed")
                break
            else:
                test_rail_conn.update_test_status(test_result="Passed")

        test_rail_conn.testcase.clear()

    request.addfinalizer(update_at_the_end)
</code></pre>

<p>The goal is to have all test cases with their results in the dictionary 'testcase' and at the end during the finalizer i want to check the value[0] field = result and see if anything failed. Problem is that after every parameter run, the testcase field is cleared and i only get single result.</p>

<p>Any help is appreciated!</p>