Commits

holger krekel committed 0454c22

add a test for one-arg case and fix

Comments (0)

Files changed (2)

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)

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]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.