Skip to content

Commit 01b085b

Browse files
committed
Update test to reflect building_documentation() change
1 parent 431ce0a commit 01b085b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pyomo/common/tests/test_flags.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import sys
1313

14+
import pyomo
1415
import pyomo.common.unittest as unittest
1516

1617
from pyomo.common.flags import NOTSET, in_testing_environment, building_documentation
@@ -23,12 +24,12 @@ def test_NOTSET(self):
2324
self.assertFalse(building_documentation())
2425

2526
self.assertEqual(str(NOTSET), 'NOTSET')
26-
self.assertNotIn('sphinx', sys.modules)
27+
self.assertFalse(hasattr(pyomo, '__sphinx_build__'))
2728
self.assertEqual(repr(NOTSET), 'pyomo.common.flags.NOTSET')
2829
self.assertIsNone(in_testing_environment.state)
2930

3031
try:
31-
sys.modules['sphinx'] = sys.modules[__name__]
32+
pyomo.__sphinx_build__ = True
3233
self.assertTrue(in_testing_environment())
3334
self.assertTrue(building_documentation())
3435
self.assertEqual(repr(NOTSET), 'NOTSET')
@@ -38,7 +39,7 @@ def test_NOTSET(self):
3839
self.assertTrue(building_documentation())
3940
self.assertEqual(repr(NOTSET), 'NOTSET')
4041
finally:
41-
del sys.modules['sphinx']
42+
del pyomo.__sphinx_build__
4243
in_testing_environment(None)
4344
self.assertIsNone(in_testing_environment.state)
4445

0 commit comments

Comments
 (0)