Message326884
The failing test was added with d4c76d960b8b286b75c933780416ace9cda682fd commit d4c76d960b8b286b75c933780416ace9cda682fd Author: INADA Naoki <methane@users.noreply.github.com> Date: Mon Oct 1 21:10:37 2018 +0900 bpo-30167: Add test for module.__cached__ is None (GH-7617) diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index dc59e5917c..33a8f1a44c 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -389,6 +389,17 @@ class ImportSideEffectTests(unittest.TestCase): "expected absolute path, got {}" .format(os__cached__.decode('ascii'))) + def test_abs_paths_cached_None(self): + """Test for __cached__ is None. + + Regarding to PEP 3147, __cached__ can be None. + + See also: https://bugs.python.org/issue30167 + """ + sys.modules['test'].__cached__ = None + site.abs_paths() + self.assertIsNone(sys.modules['test'].__cached__) + # Latest master ➜ cpython git:(master) ./python.exe -m test.regrtest test_inspect test_site Run tests sequentially 0:00:00 load avg: 1.75 [1/2] test_inspect 0:00:02 load avg: 1.75 [2/2] test_site test test_site failed -- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_site.py", line 400, in test_abs_paths_cached_None site.abs_paths() File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/site.py", line 101, in abs_paths for m in set(sys.modules.values()): TypeError: unhashable type: 'dict' test_site failed == Tests result: FAILURE == 1 test OK. 1 test failed: test_site Total duration: 2 sec 868 ms Tests result: FAILURE ➜ cpython git:(master) git checkout d4c76d960b8b286b75c933780416ace9cda682fd~1 Lib/test/test_site.py ➜ cpython git:(master) ✗ ./python.exe -m test.regrtest test_inspect test_site Run tests sequentially 0:00:00 load avg: 1.49 [1/2] test_inspect 0:00:02 load avg: 1.49 [2/2] test_site == Tests result: SUCCESS == All 2 tests OK. Total duration: 2 sec 848 ms Tests result: SUCCESS Adding INADA Naoki for thoughts. Thanks | |
| Date | User | Action | Args | | 2018-10-02 14:57:03 | xtreak | set | recipients: + xtreak, vstinner, methane, yan12125 | | 2018-10-02 14:57:03 | xtreak | set | messageid: <1538492223.39.0.545547206417.issue34871@psf.upfronthosting.co.za> | | 2018-10-02 14:57:03 | xtreak | link | issue34871 messages | | 2018-10-02 14:57:03 | xtreak | create | | |