From 0ef90459f8c249a53a0c5e9daaa8a4cf407f7fe9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 18:09:36 -0500 Subject: Convert test_develop to use pytest --- setuptools/tests/test_develop.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'setuptools/tests/test_develop.py') diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 66d182eb..9d8a56c3 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -5,7 +5,6 @@ import shutil import site import sys import tempfile -import unittest from distutils.errors import DistutilsError from setuptools.command.develop import develop @@ -23,9 +22,9 @@ setup(name='foo', INIT_PY = """print "foo" """ -class TestDevelopTest(unittest.TestCase): +class TestDevelopTest: - def setUp(self): + def setup_method(self, method): if sys.version < "2.6" or hasattr(sys, 'real_prefix'): return @@ -50,7 +49,7 @@ class TestDevelopTest(unittest.TestCase): self.old_site = site.USER_SITE site.USER_SITE = tempfile.mkdtemp() - def tearDown(self): + def teardown_method(self, method): if sys.version < "2.6" or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): return @@ -86,7 +85,7 @@ class TestDevelopTest(unittest.TestCase): # let's see if we got our egg link at the right place content = os.listdir(site.USER_SITE) content.sort() - self.assertEqual(content, ['easy-install.pth', 'foo.egg-link']) + assert content == ['easy-install.pth', 'foo.egg-link'] # Check that we are using the right code. egg_link_file = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt') @@ -100,9 +99,9 @@ class TestDevelopTest(unittest.TestCase): finally: init_file.close() if sys.version < "3": - self.assertEqual(init, 'print "foo"') + assert init == 'print "foo"' else: - self.assertEqual(init, 'print("foo")') + assert init == 'print("foo")' def notest_develop_with_setup_requires(self): -- cgit v1.2.3 From a5b9b91081943cb771a3fc7b5873410599513332 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 18:12:40 -0500 Subject: Remove consideration for older Pythons --- setuptools/tests/test_develop.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'setuptools/tests/test_develop.py') diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 9d8a56c3..890880dc 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -25,7 +25,7 @@ INIT_PY = """print "foo" class TestDevelopTest: def setup_method(self, method): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if hasattr(sys, 'real_prefix'): return # Directory structure @@ -50,7 +50,7 @@ class TestDevelopTest: site.USER_SITE = tempfile.mkdtemp() def teardown_method(self, method): - if sys.version < "2.6" or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): + if hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): return os.chdir(self.old_cwd) @@ -61,7 +61,7 @@ class TestDevelopTest: site.USER_SITE = self.old_site def test_develop(self): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if hasattr(sys, 'real_prefix'): return dist = Distribution( dict(name='foo', -- cgit v1.2.3 From c3319da5b2e4a8d597a5b27d4a034199eea78745 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 18:13:41 -0500 Subject: Remove apparently unused method. --- setuptools/tests/test_develop.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'setuptools/tests/test_develop.py') diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 890880dc..f18ddd6e 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -102,20 +102,3 @@ class TestDevelopTest: assert init == 'print "foo"' else: assert init == 'print("foo")' - - def notest_develop_with_setup_requires(self): - - wanted = ("Could not find suitable distribution for " - "Requirement.parse('I-DONT-EXIST')") - old_dir = os.getcwd() - os.chdir(self.dir) - try: - try: - Distribution({'setup_requires': ['I_DONT_EXIST']}) - except DistutilsError: - e = sys.exc_info()[1] - error = str(e) - if error == wanted: - pass - finally: - os.chdir(old_dir) -- cgit v1.2.3 From 943d583e1ec0d6e4a8a4f3be4361223c39e937d5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 09:17:00 -0500 Subject: Remove unused import --- setuptools/tests/test_develop.py | 1 - 1 file changed, 1 deletion(-) (limited to 'setuptools/tests/test_develop.py') diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index f18ddd6e..ed1b194a 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -6,7 +6,6 @@ import site import sys import tempfile -from distutils.errors import DistutilsError from setuptools.command.develop import develop from setuptools.dist import Distribution -- cgit v1.2.3