Пример #1
0
 def test_no_error_raised_when_owned_by_you(self):
     """ test calling _get_build_prefix when there is a temporary
         directory owned by you raise no InstallationError.
     """
     from pip import locations
     os.mkdir(self.get_build_dir_location())
     locations._get_build_prefix()
Пример #2
0
    def test_error_raised_when_owned_by_another(self):
        """ test calling _get_build_prefix when there is a temporary
            directory owned by another user raises an InstallationError.
        """
        from pip import locations
        os.geteuid = lambda: 1111
        os.mkdir(self.get_build_dir_location())

        with pytest.raises(pip.exceptions.InstallationError):
            locations._get_build_prefix()
Пример #3
0
 def test_dir_created(self):
     """ test that the build_prefix directory is generated when
         _get_build_prefix is called.
     """
     assert not os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should not exist yet!"
     from pip import locations
     locations._get_build_prefix()
     assert os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should now exist!"
Пример #4
0
 def test_dir_created(self):
     """ test that the build_prefix directory is generated when
         _get_build_prefix is called.
     """
     assert not os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should not exist yet!"
     from pip import locations
     locations._get_build_prefix()
     assert os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should now exist!"
Пример #5
0
    def test_error_raised_when_owned_by_another(self):
        """ test calling _get_build_prefix when there is a temporary
            directory owned by another user raises an InstallationError.
        """
        from pip import locations
        os.geteuid = lambda: 1111
        os.mkdir(self.get_build_dir_location())

        with pytest.raises(pip.exceptions.InstallationError):
            locations._get_build_prefix()
Пример #6
0
 def test_dir_created_without_NOFOLLOW(self, monkeypatch):
     """ test that the build_prefix directory is generated when
         os.O_NOFOLLOW doen't exist
     """
     if hasattr(os, 'O_NOFOLLOW'):
         monkeypatch.delattr("os.O_NOFOLLOW")
     assert not os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should not exist yet!"
     from pip import locations
     locations._get_build_prefix()
     assert os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should now exist!"
Пример #7
0
 def test_dir_created_without_NOFOLLOW(self, monkeypatch):
     """ test that the build_prefix directory is generated when
         os.O_NOFOLLOW doen't exist
     """
     if hasattr(os, 'O_NOFOLLOW'):
         monkeypatch.delattr("os.O_NOFOLLOW")
     assert not os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should not exist yet!"
     from pip import locations
     locations._get_build_prefix()
     assert os.path.exists(self.get_build_dir_location()), \
         "the build_prefix directory should now exist!"
Пример #8
0
 def test_dir_created(self):
     """ test that the build_prefix directory is generated when
         _get_build_prefix is called.
     """
     #skip on windows, build dir is not created
     if sys.platform == 'win32':
         raise SkipTest()
     assert not os.path.exists(self.get_build_dir_location() ), \
         "the build_prefix directory should not exist yet!"
     from pip import locations
     locations._get_build_prefix()
     assert os.path.exists(self.get_build_dir_location() ), \
         "the build_prefix directory should now exist!"
Пример #9
0
    def test_error_raised_when_owned_by_another_without_NOFOLLOW(self, monkeypatch):
        """ test calling _get_build_prefix when there is a temporary
            directory owned by another user raises an InstallationError.
            (when os.O_NOFOLLOW doesn't exist
        """
        if hasattr(os, 'O_NOFOLLOW'):
           monkeypatch.delattr("os.O_NOFOLLOW")
        from pip import locations
        os.geteuid = lambda : 1111
        os.mkdir(self.get_build_dir_location() )

        with pytest.raises(pip.exceptions.InstallationError):
            locations._get_build_prefix()
Пример #10
0
 def test_dir_path(self):
     """ test the path name for the build_prefix
     """
     from pip import locations
     assert locations._get_build_prefix() == self.get_build_dir_location()