Skip to content
Permalink
Browse files

Fixed #561 -- don't try to load both a directory if there's a path wi…

…th that name
  • Loading branch information
Alex Gaynor
Alex Gaynor committed Mar 30, 2013
1 parent 1144aae commit 247f4f37371a12869a200a79691ea00069041e67
Showing with 15 additions and 2 deletions.
  1. +13 −0 tests/modules/test_kernel.py
  2. +2 −2 topaz/modules/kernel.py
@@ -398,6 +398,19 @@ def to_path
""" % tmpdir)
assert w_res is space.w_true

def test_path_ambigious_directory_file(self, space, tmpdir):
f = tmpdir.join("t.rb")
f.write("""
$success = true
""")
tmpdir.join("t").ensure(dir=True)
w_res = space.execute("""
$LOAD_PATH << '%s'
require '%s'
return $success
""" % (tmpdir, tmpdir.join("t")))
assert w_res is space.w_true


class TestExec(BaseTopazTest):
def fork_and_wait(self, space, capfd, code):
@@ -49,7 +49,7 @@ def function_proc(self, space, block):
@staticmethod
def find_feature(space, path):
assert path is not None
if os.path.exists(path):
if os.path.isfile(path):
return path
if not path.endswith(".rb"):
path += ".rb"
@@ -59,7 +59,7 @@ def find_feature(space, path):
for w_base in space.listview(w_load_path):
base = Coerce.path(space, w_base)
full = os.path.join(base, path)
if os.path.exists(full):
if os.path.isfile(full):
path = os.path.join(base, path)
break
return path

0 comments on commit 247f4f3

Please sign in to comment.