Skip to content

Commit e84acca

Browse files
committed
DOC+BF: users environment dumped into doc build
The definition of the options method in the doctester has the user's enviroment as a default variable, which then gets dumped into the doc build, displaying your secret environment variables and so on. Drop the environment as a default variable.
1 parent b553753 commit e84acca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nipy/testing/doctester.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
--doctest-test``, because this file will be identified as containing tests.
55
"""
66
from __future__ import absolute_import
7+
78
import re
9+
import os
10+
811
from doctest import register_optionflag
912

1013
import numpy as np
1114
# Import for testing structured array reprs
1215
from numpy import array # noqa
1316

17+
from nipy.utils import _NoValue
1418
from ..fixes.numpy.testing.noseclasses import (NumpyDoctest,
1519
NumpyOutputChecker)
1620

@@ -208,3 +212,12 @@ class NipyDoctest(NumpyDoctest):
208212
def set_test_context(self, test):
209213
# set namespace for tests
210214
test.globs['np'] = np
215+
216+
def options(self, parser, env=_NoValue):
217+
# Override option handling to take environment out of default values.
218+
# Parent class has os.environ as default value for env. This results
219+
# in the environment being picked up and printed out in the built API
220+
# documentation. Remove this default, reset it inside the function.
221+
if env is _NoValue:
222+
env = os.environ
223+
super(NipyDoctest, self).options(parser, env)

0 commit comments

Comments
 (0)