summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Forbes <tom@tomforb.es>2019-06-26 05:44:10 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-26 06:44:57 +0200
commitbdc1de21992bfbc58e719442d3fb990894b6b713 (patch)
tree9bf936152f628f7c2783021e4efd5db9ab800a0f /tests
parent04965bf92d3064cff1a10dd401b7368e54164148 (diff)
[2.2.x] Fixed #30588 -- Fixed crash of autoreloader when __main__ module doesn't have __file__ attribute.
Backport of 8454f6dea49dddb821bfcb7569ea222bb487dfd1 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/utils_tests/test_autoreload.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 56b03d40a6..c7308ca53a 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -134,6 +134,10 @@ class TestIterModulesAndFiles(SimpleTestCase):
main_module = sys.modules['__main__']
self.assertFileFound(Path(main_module.__file__))
+ def test_main_module_without_file_is_not_resolved(self):
+ fake_main = types.ModuleType('__main__')
+ self.assertEqual(autoreload.iter_modules_and_files((fake_main,), frozenset()), frozenset())
+
class TestCommonRoots(SimpleTestCase):
def test_common_roots(self):