| 1 | import unittest |
| 2 | from doctest import DocTestSuite |
| 3 | from test import test_support |
| 4 | |
| 5 | def test_main(): |
| 6 | suite = DocTestSuite('_threading_local') |
| 7 | |
| 8 | try: |
| 9 | from thread import _local |
| 10 | except ImportError: |
| 11 | pass |
| 12 | else: |
| 13 | import _threading_local |
| 14 | local_orig = _threading_local.local |
| 15 | def setUp(test): |
| 16 | _threading_local.local = _local |
| 17 | def tearDown(test): |
| 18 | _threading_local.local = local_orig |
| 19 | suite.addTest(DocTestSuite('_threading_local', |
| 20 | setUp=setUp, tearDown=tearDown) |
| 21 | ) |
| 22 | |
| 23 | test_support.run_suite(suite) |
| 24 | |
| 25 | if __name__ == '__main__': |
| 26 | test_main() |