{"action":"created","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest/issues/651","labels_url":"https://api.github.com/repos/pytest-dev/pytest/issues/651/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/issues/651/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest/issues/651/events","html_url":"https://github.com/pytest-dev/pytest/issues/651","id":88536196,"number":651,"title":"test fails in ntpath.py when LocalPath has no len","user":{"login":"pytestbot","id":12873537,"avatar_url":"https://avatars.githubusercontent.com/u/12873537?v=3","gravatar_id":"","url":"https://api.github.com/users/pytestbot","html_url":"https://github.com/pytestbot","followers_url":"https://api.github.com/users/pytestbot/followers","following_url":"https://api.github.com/users/pytestbot/following{/other_user}","gists_url":"https://api.github.com/users/pytestbot/gists{/gist_id}","starred_url":"https://api.github.com/users/pytestbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytestbot/subscriptions","organizations_url":"https://api.github.com/users/pytestbot/orgs","repos_url":"https://api.github.com/users/pytestbot/repos","events_url":"https://api.github.com/users/pytestbot/events{/privacy}","received_events_url":"https://api.github.com/users/pytestbot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pytest-dev/pytest/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-01T16:35:52Z","updated_at":"2015-07-08T08:39:14Z","closed_at":null,"body":"Originally reported by: **Jason R. Coombs (BitBucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**\n\n----------------------------------------\n\nConsider this simple test:\n\n```\ndef test_simple(tmpdir):\n    import os\n    os.path.join(tmpdir, 'foo')\n```\n\nInvoke that test on Windows in pytest 2.6.4, and you'll get a failure:\n\n```\n============================= test session starts ============================= platform win32 -- Python 3.4.2 -- py-1.4.26 -- pytest-2.6.4\ncollected 1 items\n\ntest_join.py F\n\n================================== FAILURES =================================== _________________________________ test_simple _________________________________\n\ntmpdir = local('C:\\\\Users\\\\jaraco\\\\AppData\\\\Local\\\\Temp\\\\pytest-19\\\\test_simple0')\n\n    def test_simple(tmpdir):\n        import os\n>       os.path.join(tmpdir, 'foo')\n\ntest_join.py:3:\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\nc:\\python\\lib\\ntpath.py:108: in join\n    result_drive, result_path = splitdrive(path)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\np = local('C:\\\\Users\\\\jaraco\\\\AppData\\\\Local\\\\Temp\\\\pytest-19\\\\test_simple0')\n\n    def splitdrive(p):\n        \"\"\"Split a pathname into drive/UNC sharepoint and relative path specifiers.\n        Returns a 2-tuple (drive_or_unc, path); either part may be empty.\n\n        If you assign\n            result = splitdrive(p)\n        It is always true that:\n            result[0] + result[1] == p\n\n        If the path contained a drive letter, drive_or_unc will contain everything\n        up to and including the colon.  e.g. splitdrive(\"c:/dir\") returns (\"c:\", \"/dir\")\n\n        If the path contained a UNC path, the drive_or_unc will contain the host name\n        and share up to but not including the fourth directory separator character.\n        e.g. splitdrive(\"//host/computer/dir\") returns (\"//host/computer\", \"/dir\")\n\n        Paths cannot contain both a drive letter and a UNC path.\n\n        \"\"\"\n        empty = _get_empty(p)\n>       if len(p) > 1:\nE       TypeError: object of type 'LocalPath' has no len()\n\nc:\\python\\lib\\ntpath.py:159: TypeError\n========================== 1 failed in 0.07 seconds ===========================\n```\n\nShould LocalPath support join operations or should the tester expect to convert the LocalPath to a `str` before invoking join?\n\nProbably the preferred usage is to use the `.join()` method on LocalPath,  but that's less obvious.\n\n----------------------------------------\n- Bitbucket: https://bitbucket.org/pytest-dev/pytest/issue/651\n"},"comment":{"url":"https://api.github.com/repos/pytest-dev/pytest/issues/comments/119498615","html_url":"https://github.com/pytest-dev/pytest/issues/651#issuecomment-119498615","issue_url":"https://api.github.com/repos/pytest-dev/pytest/issues/651","id":119498615,"user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T08:39:14Z","updated_at":"2015-07-08T08:39:14Z","body":"I think it's intentional that `py.path` objects are *not* interchangable with strings - you'll see the same with `pathlib` from the python 3.4 stdlib for example, except for some functions (like `os.path.join`) which were adjusted to take `Path` objects:\r\n\r\n```\r\n>>> os.stat(pathlib.Path('foo') / 'bar')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nTypeError: argument should be string, bytes or integer, not PosixPath\r\n```\r\n\r\nSo I think this can be closed if you agree, @jaraco :smile:"}}