Fix test_capi.test_misc when run with -R:: (#107566)

Should fix the buildbot failures.

This creates a new function each time that test is run, like Victor did for other tests.

1 file changed