summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 2b92255..2956d73 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -185,10 +185,28 @@ class StatAttributeTests(unittest.TestCase):
except TypeError:
pass
+from test_userdict import TestMappingProtocol
+
+class EnvironTests(TestMappingProtocol):
+ """check that os.environ object conform to mapping protocol"""
+ _tested_class = None
+ def _reference(self):
+ return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"}
+ def _empty_mapping(self):
+ os.environ.clear()
+ return os.environ
+ def setUp(self):
+ self.__save = dict(os.environ)
+ os.environ.clear()
+ def tearDown(self):
+ os.environ.clear()
+ os.environ.update(self.__save)
+
def test_main():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TemporaryFileTests))
suite.addTest(unittest.makeSuite(StatAttributeTests))
+ suite.addTest(unittest.makeSuite(EnvironTests))
run_suite(suite)
if __name__ == "__main__":