diff options
Diffstat (limited to 'tests/unit/test_locations.py')
-rw-r--r-- | tests/unit/test_locations.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/unit/test_locations.py b/tests/unit/test_locations.py index e272c7661..89f0c95ce 100644 --- a/tests/unit/test_locations.py +++ b/tests/unit/test_locations.py @@ -7,9 +7,10 @@ import sys import shutil import tempfile import getpass + +import pytest + from mock import Mock -from nose import SkipTest -from nose.tools import assert_raises, assert_equal import pip if sys.platform == 'win32': @@ -84,16 +85,14 @@ class TestLocations: """ test the path name for the build_prefix """ from pip import locations - assert_equal(locations._get_build_prefix(), - self.get_build_dir_location()) + assert locations._get_build_prefix() == self.get_build_dir_location() + #skip on windows, build dir is not created + @pytest.mark.skipif("sys.platform == 'win32'") 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 @@ -101,17 +100,18 @@ class TestLocations: assert os.path.exists(self.get_build_dir_location() ), \ "the build_prefix directory should now exist!" + #skip on windows; this exception logic only runs on linux + @pytest.mark.skipif("sys.platform == 'win32'") 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. """ - #skip on windows; this exception logic only runs on linux - if sys.platform == 'win32': - raise SkipTest() from pip import locations os.geteuid = lambda : 1111 os.mkdir(self.get_build_dir_location() ) - assert_raises(pip.exceptions.InstallationError, locations._get_build_prefix) + + with pytest.raises(pip.exceptions.InstallationError): + locations._get_build_prefix() def test_no_error_raised_when_owned_by_you(self): """ test calling _get_build_prefix when there is a temporary |