def test_broken_py_path_local_join_workaround_on_Windows(self, tmpdir, initproj, monkeypatch): # construct an absolute folder path for our src_root folder without the # Windows drive indicator src_root = tmpdir.join("spam") src_root = _path_parts(src_root) src_root[0] = "" src_root = "/".join(src_root) # make sure tmpdir drive is the current one so the constructed src_root # folder path gets interpreted correctly on Windows monkeypatch.chdir(tmpdir) # will throw an assertion error if the bug is not worked around initproj("spam-666", src_root=src_root) init_file = tmpdir.join("spam", "spam", "__init__.py") expected = b'""" module spam """' + linesep_bytes() + b"__version__ = '666'" assert init_file.read_binary() == expected
def test_broken_py_path_local_join_workaround_on_Windows( self, tmpdir, initproj, monkeypatch): # construct an absolute folder path for our src_root folder without the # Windows drive indicator src_root = tmpdir.join('spam') src_root = _path_parts(src_root) src_root[0] = '' src_root = '/'.join(src_root) # make sure tmpdir drive is the current one so the constructed src_root # folder path gets interpreted correctly on Windows monkeypatch.chdir(tmpdir) # will throw an assertion error if the bug is not worked around initproj('spam-666', src_root=src_root) init_file = tmpdir.join('spam', 'spam', '__init__.py') assert init_file.read_binary() == b"__version__ = '666'"
def test_on_py_path(self): cwd_parts = _path_parts(py.path.local()) folder_parts = _path_parts(py.path.local("a/b/c")) assert folder_parts[len(cwd_parts):] == ["a", "b", "c"]
def test_path_parts(self, input, expected): assert _path_parts(input) == expected
def test_on_py_path(self): cwd_parts = _path_parts(py.path.local()) folder_parts = _path_parts(py.path.local('a/b/c')) assert folder_parts[len(cwd_parts):] == ['a', 'b', 'c']