human
Complete the below
@pytest.fixture(scope='session')
def clean_jedi_cache(request):

    ''''Set `jedi.settings.cache_directory` to a temporary directory during test.
    Note that you can\'t use built-in `tmpdir` and `monkeypatch`
    fixture here because their scope is \'function\', which is not used
    in \'session\' scope fixture.
    This fixture is activated in ../pytest.ini.'
    '''

Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    from jedi import settings
    old = settings.cache_directory
    tmp = tempfile.mkdtemp(prefix='jedi-test-')
    settings.cache_directory = tmp
    @request.addfinalizer
    def restore():
        settings.cache_directory = old
        shutil.rmtree(tmp)