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

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

Open
pdxjohnny opened this issue Feb 28, 2020 · 0 comments
Open

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

pdxjohnny opened this issue Feb 28, 2020 · 0 comments

Comments

@pdxjohnny
Copy link
Member

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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant