On Tuesday, June 11, 2013 8:49:11 PM UTC+4, ZyX wrote:
> On Tuesday, June 11, 2013 8:45:04 PM UTC+4, ZyX wrote:
> > > I will investigate the issue further. Currently I can only say that if I 
> > > try to use import with trailing directories in a living system bug does 
> > > appear (for python-2* only), but the following tests work in both pythons 
> > > which is rather strange:
> > 
> > Problem is not with importing packages, but with second-level import in 
> > imported packages: with mocked sys.path import does not work as it does not 
> > know where to import from.
> 
> And also problem with me forgetting to change two "before" to "after" in 
> place of one.

This variant of tests *fails* as expected with test86.in (not with test87.in), 
though it should not:

diff -r 7fda29626053 src/testdir/python_after/after.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/python_after/after.py Tue Jun 11 20:51:50 2013 +0400
@@ -0,0 +1,2 @@
+import before
+dir = "after"
diff -r 7fda29626053 src/testdir/python_before/before.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/python_before/before.py       Tue Jun 11 20:51:50 2013 +0400
@@ -0,0 +1,1 @@
+dir = "before"
diff -r 7fda29626053 src/testdir/test86.in
--- a/src/testdir/test86.in     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test86.in     Tue Jun 11 20:51:50 2013 +0400
@@ -1069,13 +1069,19 @@
 ee('vim.current.xxx = True')
 EOF
 :"
-:" Test import  TODO: BROKEN
-:"py << EOF
-:"vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
-:"from module import dir as d
-:"from modulex import ddir
-:"cb.append(d + ',' + ddir)
-:"EOF
+:" Test import
+py << EOF
+sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
+sys.path.append(os.path.join(os.getcwd(), 'python_after'))
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+from module import dir as d
+from modulex import ddir
+cb.append(d + ',' + ddir)
+import before
+cb.append(before.dir)
+import after
+cb.append(after.dir)
+EOF
 :"
 :" Test exceptions
 :fun Exe(e)
diff -r 7fda29626053 src/testdir/test86.ok
--- a/src/testdir/test86.ok     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test86.ok     Tue Jun 11 20:51:50 2013 +0400
@@ -1083,6 +1083,9 @@
 vim.current.window = True:(<type 'exceptions.TypeError'>, TypeError('expected 
vim.Window object',))
 vim.current.tabpage = True:(<type 'exceptions.TypeError'>, TypeError('expected 
vim.TabPage object',))
 vim.current.xxx = True:(<type 'exceptions.AttributeError'>, 
AttributeError('xxx',))
+2,xx
+before
+after
 vim.command("throw 'abc'"):(<class 'vim.error'>, error('abc',))
 Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))
diff -r 7fda29626053 src/testdir/test87.in
--- a/src/testdir/test87.in     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test87.in     Tue Jun 11 20:51:50 2013 +0400
@@ -1036,13 +1036,19 @@
 ee('vim.current.xxx = True')
 EOF
 :"
-:" Test import  TODO: BROKEN
-:"py3 << EOF
-:"vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
-:"from module import dir as d
-:"from modulex import ddir
-:"cb.append(d + ',' + ddir)
-:"EOF
+:" Test import
+py3 << EOF
+sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
+sys.path.append(os.path.join(os.getcwd(), 'python_after'))
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+from module import dir as d
+from modulex import ddir
+cb.append(d + ',' + ddir)
+import before
+cb.append(before.dir)
+import after
+cb.append(after.dir)
+EOF
 :"
 :" Test exceptions
 :fun Exe(e)
diff -r 7fda29626053 src/testdir/test87.ok
--- a/src/testdir/test87.ok     Tue Jun 11 00:11:46 2013 +0400
+++ b/src/testdir/test87.ok     Tue Jun 11 20:51:50 2013 +0400
@@ -1092,6 +1092,9 @@
 vim.current.window = True:(<class 'TypeError'>, TypeError('expected vim.Window 
object',))
 vim.current.tabpage = True:(<class 'TypeError'>, TypeError('expected 
vim.TabPage object',))
 vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',))
+3,xx
+before
+after
 vim.command("throw 'abc'"):(<class 'vim.error'>, error('abc',))
 Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui