def test_prefix_and_target(self, sp_writable): sp_writable.return_value = False assert decide_user_install(use_user_site=None, prefix_path='foo') is False assert decide_user_install(use_user_site=None, target_dir='bar') is False
def test_most_cases( self, enable_user_site, site_packages_writable, result, monkeypatch, ): monkeypatch.setattr('site.ENABLE_USER_SITE', enable_user_site) monkeypatch.setattr( 'pip._internal.commands.install.site_packages_writable', lambda **kw: site_packages_writable ) assert decide_user_install(use_user_site=None) is result
def test_most_cases( self, enable_user_site: bool, site_packages_writable: bool, result: bool, monkeypatch: pytest.MonkeyPatch, ) -> None: monkeypatch.setattr("site.ENABLE_USER_SITE", enable_user_site) monkeypatch.setattr( "pip._internal.commands.install.site_packages_writable", lambda **kw: site_packages_writable, ) assert decide_user_install(use_user_site=None) is result
def test_prefix_and_target(self, sp_writable: mock.Mock) -> None: sp_writable.return_value = False assert decide_user_install(use_user_site=None, prefix_path="foo") is False assert decide_user_install(use_user_site=None, target_dir="bar") is False