Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Add info on how to run doctests in temporary directory #1

@johnandersen777

Description

@johnandersen777

The following code goes in doctest_global_setup in docs/conf.py

import os
import shutil
import atexit
import tempfile
import functools

# Create a temporary directory for test to run in
TEMPDIR = tempfile.mkdtemp()
# Remove it when the test exits
atexit.register(functools.partial(shutil.rmtree, TEMPDIR))
# Change the current working directory to the temporary directory
os.chdir(TEMPDIR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions