def test_get_url_from_path__installable_error(isdir_mock): isdir_mock.return_value = True name = 'some/setuptools/project' path = os.path.join('/path/to/' + name) with pytest.raises(InstallationError) as e: _get_url_from_path(path, name) err_msg = e.value.args[0] assert "Neither 'setup.py' nor 'pyproject.toml' found" in err_msg
def test_get_url_from_path__archive_file(isdir_mock, isfile_mock): isdir_mock.return_value = False isfile_mock.return_value = True name = 'simple-0.1-py2.py3-none-any.whl' path = os.path.join('/path/to/' + name) url = path_to_url(path) assert _get_url_from_path(path, name) == url
def test_get_url_from_path__installable_dir(isdir_mock, isfile_mock): isdir_mock.return_value = True isfile_mock.return_value = True name = 'some/setuptools/project' path = os.path.join('/path/to/' + name) url = path_to_url(path) assert _get_url_from_path(path, name) == url
def test_get_url_from_path__installable_dir(isdir_mock: mock.Mock, isfile_mock: mock.Mock) -> None: isdir_mock.return_value = True isfile_mock.return_value = True name = "some/setuptools/project" url = Path(f"/path/to/{name}").resolve(strict=False).as_uri() assert _get_url_from_path(f"/path/to/{name}", name) == url
def test_get_url_from_path__archive_file(isdir_mock: mock.Mock, isfile_mock: mock.Mock) -> None: isdir_mock.return_value = False isfile_mock.return_value = True name = "simple-0.1-py2.py3-none-any.whl" url = Path(f"/path/to/{name}").resolve(strict=False).as_uri() assert _get_url_from_path(f"/path/to/{name}", name) == url
def test_get_url_from_path__installable_dir(isdir_mock: mock.Mock, isfile_mock: mock.Mock) -> None: isdir_mock.return_value = True isfile_mock.return_value = True name = "some/setuptools/project" path = os.path.join("/path/to/" + name) url = path_to_url(path) assert _get_url_from_path(path, name) == url
def test_get_url_from_path( isdir_mock: mock.Mock, isfile_mock: mock.Mock, args: Tuple[str, str], mock_returns: Tuple[bool, bool], expected: None, ) -> None: isdir_mock.return_value = mock_returns[0] isfile_mock.return_value = mock_returns[1] assert _get_url_from_path(*args) is expected
def test_get_url_from_path(isdir_mock, isfile_mock, args, mock_returns, expected): isdir_mock.return_value = mock_returns[0] isfile_mock.return_value = mock_returns[1] assert _get_url_from_path(*args) is expected