Skip to content

Commit b875bee

Browse files
committed
added spec in test.test_pyclbr.py
added spec for test when calling directly
1 parent a9c7bc0 commit b875bee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_pyclbr.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,12 @@ def test_module_has_no_spec(self):
260260

261261

262262
if __name__ == "__main__":
263+
import importlib.util
264+
265+
# Adding the __spec__ attribute to the __main__ module
266+
if getattr(sys.modules["__main__"], "__spec__", None) is None:
267+
sys.modules["__main__"].__spec__ = importlib.machinery.ModuleSpec(
268+
name="__main__", loader=None, origin="builtin"
269+
)
270+
263271
unittest_main()

0 commit comments

Comments
 (0)