summaryrefslogtreecommitdiff
path: root/astroid/tests/testdata/python3/data/package
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-11-09 22:44:59 +0100
committerTorsten Marek <shlomme@gmail.com>2014-11-09 22:44:59 +0100
commitf5952d500ca1052252a0d8699be7ca3cf8e4eeda (patch)
tree24950b435ecabac9e22f1a22ce03de980dcd231a /astroid/tests/testdata/python3/data/package
parent7b8f664cf8aa5e8f2e7f444b2274ae62b6390e1c (diff)
downloadastroid-f5952d500ca1052252a0d8699be7ca3cf8e4eeda.tar.gz
Merge all test data into a single package per Python version.
Also modernized a lot of test code. This makes it possible to run the tests from both the base directory of the project as well as the astroid package. Since the packages have the same name for Python 2 and 3, there is less version-dependent code in the tests.
Diffstat (limited to 'astroid/tests/testdata/python3/data/package')
-rw-r--r--astroid/tests/testdata/python3/data/package/__init__.py4
-rw-r--r--astroid/tests/testdata/python3/data/package/absimport.py6
-rw-r--r--astroid/tests/testdata/python3/data/package/hello.py2
-rw-r--r--astroid/tests/testdata/python3/data/package/import_package_subpackage_module.py49
-rw-r--r--astroid/tests/testdata/python3/data/package/subpackage/__init__.py1
-rw-r--r--astroid/tests/testdata/python3/data/package/subpackage/module.py1
6 files changed, 63 insertions, 0 deletions
diff --git a/astroid/tests/testdata/python3/data/package/__init__.py b/astroid/tests/testdata/python3/data/package/__init__.py
new file mode 100644
index 0000000..575d18b
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/__init__.py
@@ -0,0 +1,4 @@
+"""package's __init__ file"""
+
+
+from . import subpackage
diff --git a/astroid/tests/testdata/python3/data/package/absimport.py b/astroid/tests/testdata/python3/data/package/absimport.py
new file mode 100644
index 0000000..33ed117
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/absimport.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import, print_function
+import import_package_subpackage_module # fail
+print(import_package_subpackage_module)
+
+from . import hello as hola
+
diff --git a/astroid/tests/testdata/python3/data/package/hello.py b/astroid/tests/testdata/python3/data/package/hello.py
new file mode 100644
index 0000000..b154c84
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/hello.py
@@ -0,0 +1,2 @@
+"""hello module"""
+
diff --git a/astroid/tests/testdata/python3/data/package/import_package_subpackage_module.py b/astroid/tests/testdata/python3/data/package/import_package_subpackage_module.py
new file mode 100644
index 0000000..ad442c1
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/import_package_subpackage_module.py
@@ -0,0 +1,49 @@
+# pylint: disable-msg=I0011,C0301,W0611
+"""I found some of my scripts trigger off an AttributeError in pylint
+0.8.1 (with common 0.12.0 and astroid 0.13.1).
+
+Traceback (most recent call last):
+ File "/usr/bin/pylint", line 4, in ?
+ lint.Run(sys.argv[1:])
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 729, in __init__
+ linter.check(args)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 412, in check
+ self.check_file(filepath, modname, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 426, in check_file
+ astroid = self._check_file(filepath, modname, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 450, in _check_file
+ self.check_astroid_module(astroid, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 494, in check_astroid_module
+ self.astroid_events(astroid, [checker for checker in checkers
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
+ self.astroid_events(child, checkers, _reversed_checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
+ self.astroid_events(child, checkers, _reversed_checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 508, in astroid_events
+ checker.visit(astroid)
+ File "/usr/lib/python2.4/site-packages/logilab/astroid/utils.py", line 84, in visit
+ method(node)
+ File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 295, in visit_import
+ self._check_module_attrs(node, module, name_parts[1:])
+ File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 357, in _check_module_attrs
+ self.add_message('E0611', args=(name, module.name),
+AttributeError: Import instance has no attribute 'name'
+
+
+You can reproduce it by:
+(1) create package structure like the following:
+
+package/
+ __init__.py
+ subpackage/
+ __init__.py
+ module.py
+
+(2) in package/__init__.py write:
+
+import subpackage
+
+(3) run pylint with a script importing package.subpackage.module.
+"""
+__revision__ = '$Id: import_package_subpackage_module.py,v 1.1 2005-11-10 15:59:32 syt Exp $'
+import package.subpackage.module
diff --git a/astroid/tests/testdata/python3/data/package/subpackage/__init__.py b/astroid/tests/testdata/python3/data/package/subpackage/__init__.py
new file mode 100644
index 0000000..dc4782e
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/subpackage/__init__.py
@@ -0,0 +1 @@
+"""package.subpackage"""
diff --git a/astroid/tests/testdata/python3/data/package/subpackage/module.py b/astroid/tests/testdata/python3/data/package/subpackage/module.py
new file mode 100644
index 0000000..4b7244b
--- /dev/null
+++ b/astroid/tests/testdata/python3/data/package/subpackage/module.py
@@ -0,0 +1 @@
+"""package.subpackage.module"""