Commits

holger krekel  committed 0454c22

add a test for one-arg case and fix

  • Participants
  • Parent commits 6bb2585

Comments (0)

Files changed (2)

File py/_path/local.py

             if self._patternchars.isdisjoint(fil):
                 child = self._fastjoin(fil)
                 if os.path.exists(child.strpath):
-                    return [new]
+                    return [child]
                 return []
             fil = common.FNMatcher(fil)
         names = py.error.checked_call(os.listdir, self.strpath)

File testing/path/test_local.py

         p2 = p.__class__(str(p).upper())
         assert p1.samefile(p2)
 
+def test_listdir_single_arg(tmpdir):
+    tmpdir.ensure("hello")
+    assert tmpdir.listdir("hello")[0].basename == "hello"
+
 def test_mkdtemp_rootdir(tmpdir):
     dtmp = local.mkdtemp(rootdir=tmpdir)
     assert tmpdir.listdir() == [dtmp]