Add absolute_import failing SSCCE, and get pytest to ignore it

This commit is contained in:
Laurens Van Houtven
2013-06-21 19:25:18 +02:00
parent 5701ac1a10
commit d32045303f
4 changed files with 36 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
addopts = --doctest-modules
# Ignore broken files in blackbox test directories
norecursedirs = .* docs completion refactor
norecursedirs = .* docs completion refactor absolute_import
# Activate `clean_jedi_cache` fixture for all tests. This should be
# fine as long as we are using `clean_jedi_cache` as a session scoped

View File

@@ -0,0 +1,13 @@
"""
This is a module that imports the *standard library* unittest,
despite there being a local "unittest" module. It specifies that it
wants the stdlib one with the ``absolute_import`` __future__ import.
The twisted equivalent of this module is ``twisted.trial._synctest``.
"""
from __future__ import absolute_import
import unittest # this is stdlib unittest, but jedi gets the local one
class Assertions(unittest.TestCase):
pass

View File

@@ -0,0 +1,9 @@
import jedi
filename = "unittest.py"
with open(filename) as f:
lines = f.readlines()
src = "".join(lines)
script = jedi.Script(src, len(lines), len(lines[1]), filename)
print script.completions()

View File

@@ -0,0 +1,13 @@
"""
This is a module that shadows a builtin (intentionally).
It imports a local module, which in turn imports stdlib unittest (the
name shadowed by this module). If that is properly resolved, there's
no problem. However, if jedi doesn't understand absolute_imports, it
will get this module again, causing infinite recursion.
"""
from local_module import Assertions
class TestCase(Assertions):
def test(self):
self.assertT