diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-08-27 16:51:33 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-27 16:51:33 -0400 |
| commit | 4c3bf08947a9fa37e2463628d20c8316dc6dd71b (patch) | |
| tree | eb59a8a14859ac6707db97ab2e5a309b5a03beab /tests | |
| parent | 13b1c7fa08d5a238b3995b17de551abd5d31993e (diff) | |
| download | astroid-git-4c3bf08947a9fa37e2463628d20c8316dc6dd71b.tar.gz | |
Fix namespace package detection for frozen stdlib modules on PyPy (#1757)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_manager.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unittest_manager.py b/tests/unittest_manager.py index 5bce2904..fd5787d4 100644 --- a/tests/unittest_manager.py +++ b/tests/unittest_manager.py @@ -10,9 +10,11 @@ import unittest from collections.abc import Iterator from contextlib import contextmanager +import pytest + import astroid from astroid import manager, test_utils -from astroid.const import IS_JYTHON +from astroid.const import IS_JYTHON, IS_PYPY from astroid.exceptions import AstroidBuildingError, AstroidImportError from astroid.interpreter._import import util from astroid.modutils import is_standard_module @@ -128,6 +130,7 @@ class AstroidManagerTest( def test_module_is_not_namespace(self) -> None: self.assertFalse(util.is_namespace("tests.testdata.python3.data.all")) self.assertFalse(util.is_namespace("__main__")) + self.assertFalse(util.is_namespace("importlib._bootstrap")) def test_module_unexpectedly_missing_spec(self) -> None: astroid_module = sys.modules["astroid"] @@ -155,6 +158,10 @@ class AstroidManagerTest( for _ in range(2): sys.path.pop(0) + @pytest.mark.skipif( + IS_PYPY, + reason="PyPy provides no way to tell apart frozen stdlib from old-style namespace packages", + ) def test_namespace_package_pth_support(self) -> None: pth = "foogle_fax-0.12.5-py2.7-nspkg.pth" site.addpackage(resources.RESOURCE_PATH, pth, []) @@ -169,6 +176,10 @@ class AstroidManagerTest( finally: sys.modules.pop("foogle") + @pytest.mark.skipif( + IS_PYPY, + reason="PyPy provides no way to tell apart frozen stdlib from old-style namespace packages", + ) def test_nested_namespace_import(self) -> None: pth = "foogle_fax-0.12.5-py2.7-nspkg.pth" site.addpackage(resources.RESOURCE_PATH, pth, []) |
