diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-11-01 17:51:28 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-11-01 17:54:19 +0200 |
commit | 7557f8f3af764d58a8fcdeecb248190b79a508cc (patch) | |
tree | cd4fcc3851a1797f2ada1ce5930ece6d6b412752 | |
parent | ef965b545bdf765ea0dff1624a3258b2f1ba482d (diff) | |
download | astroid-git-7557f8f3af764d58a8fcdeecb248190b79a508cc.tar.gz |
Add the full path to the resources's data directory when testing the namespace package pth support.
-rw-r--r-- | astroid/tests/resources.py | 2 | ||||
-rw-r--r-- | astroid/tests/unittest_manager.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/astroid/tests/resources.py b/astroid/tests/resources.py index fa53324f..d1271989 100644 --- a/astroid/tests/resources.py +++ b/astroid/tests/resources.py @@ -16,9 +16,11 @@ import six from astroid import builder from astroid import MANAGER +from astroid import tests DATA_DIR = 'testdata' +RESOURCE_PATH = os.path.join(tests.__path__[0], DATA_DIR, 'data') BUILTINS = six.moves.builtins.__name__ diff --git a/astroid/tests/unittest_manager.py b/astroid/tests/unittest_manager.py index e5b48d53..e3702f0b 100644 --- a/astroid/tests/unittest_manager.py +++ b/astroid/tests/unittest_manager.py @@ -124,10 +124,11 @@ class AstroidManagerTest(resources.SysPathSetup, sys.path.pop(0) def test_namespace_package_pth_support(self): - directory = os.path.join(resources.DATA_DIR, 'data') pth = 'foogle_fax-0.12.5-py2.7-nspkg.pth' - site.addpackage(directory, pth, []) + site.addpackage(resources.RESOURCE_PATH, pth, []) + # pylint: disable=no-member; can't infer _namespace_packages, created at runtime. pkg_resources._namespace_packages['foogle'] = [] + try: module = self.manager.ast_from_module_name('foogle.fax') submodule = next(module.igetattr('a')) |