summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_autoreload.py
diff options
context:
space:
mode:
authorshiningfm <shiningfm@users.noreply.github.com>2019-02-27 16:35:30 +0100
committerTim Graham <timograham@gmail.com>2019-02-27 10:35:30 -0500
commit99cfb28e995388db109e2f2ed15307f09945dda8 (patch)
treebb5527c4d510db3366df8e8048e432e7619a3dcd /tests/utils_tests/test_autoreload.py
parent5deb7a86e8b54d052a3b1dbed1ae7142d362b1c5 (diff)
Fixed #30215 -- Fixed autoreloader crash for modules without __spec__.
Regression in c8720e7696ca41f3262d5369365cc1bd72a216ca.
Diffstat (limited to 'tests/utils_tests/test_autoreload.py')
-rw-r--r--tests/utils_tests/test_autoreload.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index cc6ea758da..3a8bf99983 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -6,6 +6,7 @@ import sys
import tempfile
import threading
import time
+import types
import weakref
import zipfile
from importlib import import_module
@@ -124,6 +125,11 @@ class TestIterModulesAndFiles(SimpleTestCase):
self.addCleanup(lambda: sys.modules.pop('time_proxy', None))
list(autoreload.iter_all_python_module_files()) # No crash.
+ def test_module_without_spec(self):
+ module = types.ModuleType('test_module')
+ del module.__spec__
+ self.assertEqual(autoreload.iter_modules_and_files((module,), frozenset()), frozenset())
+
class TestCommonRoots(SimpleTestCase):
def test_common_roots(self):