commit:     36591fe050f9a043b56ef0546de18585d43db015
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 28 09:29:23 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Mon Dec 28 13:34:28 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36591fe0

dev-python/distlib: Fix varios test failures

Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=558706
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=558708
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=569922

Package-Manager: portage-2.2.26
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 dev-python/distlib/distlib-0.2.1-r1.ebuild         |  11 +-
 .../distlib/files/distlib-0.2.1-online.patch       | 113 +++++++++++++++++++++
 2 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/dev-python/distlib/distlib-0.2.1-r1.ebuild 
b/dev-python/distlib/distlib-0.2.1-r1.ebuild
index 1a438d6..8b8f7c9 100644
--- a/dev-python/distlib/distlib-0.2.1-r1.ebuild
+++ b/dev-python/distlib/distlib-0.2.1-r1.ebuild
@@ -20,6 +20,7 @@ IUSE=""
 
 PATCHES=(
        "${FILESDIR}"/${P}-unbundle.patch
+       "${FILESDIR}"/${P}-online.patch
 )
 
 python_prepare_all() {
@@ -29,20 +30,24 @@ python_prepare_all() {
                tests/test_shutil.py* \
                tests/test_sysconfig.py* || die
 
+       distutils-r1_python_prepare_all
+
        # Broken tests
        # 1 fails due to it being sensitive to dictionary ordering
        # inconsistency between code and test
        sed \
                -e 's:test_dependency_finder:_&:g' \
-               -e 's:test_abi:_&:g' \
                -i tests/*py || die
 
-       distutils-r1_python_prepare_all
+       # Gentoo still doesn't report correct ABI
+       sed \
+               -e 's:test_abi:_&:g' \
+               -i tests/*py || die
 }
 
 python_test() {
        sed \
                -e '/PIP_AVAILABLE/s:True:False:g' \
                -i tests/*py || die
-       PYTHONHASHSEED=0 esetup.py test
+       SKIP_ONLINE=True PYTHONHASHSEED=0 esetup.py test
 }

diff --git a/dev-python/distlib/files/distlib-0.2.1-online.patch 
b/dev-python/distlib/files/distlib-0.2.1-online.patch
new file mode 100644
index 0000000..3d5d655
--- /dev/null
+++ b/dev-python/distlib/files/distlib-0.2.1-online.patch
@@ -0,0 +1,113 @@
+ tests/test_index.py    |  1 +
+ tests/test_locators.py | 10 ++++++++++
+ tests/test_util.py     |  1 +
+ 3 files changed, 12 insertions(+)
+
+diff --git a/tests/test_index.py b/tests/test_index.py
+index a188816..dbef670 100644
+--- a/tests/test_index.py
++++ b/tests/test_index.py
+@@ -290,6 +290,7 @@ class PackageIndexTestCase(unittest.TestCase):
+         self.assertRaises(DistlibException, self.index.download_file, url, fn,
+                           digest[:-1] + '8')
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_search(self):
+         self.index = PackageIndex()
+         result = self.index.search({'name': 'tatterdema'})
+diff --git a/tests/test_locators.py b/tests/test_locators.py
+index de97541..436ea9d 100644
+--- a/tests/test_locators.py
++++ b/tests/test_locators.py
+@@ -29,6 +29,7 @@ PYPI_WEB_HOST = os.environ.get('PYPI_WEB_HOST', 
'https://pypi.python.org/simple/
+ class LocatorTestCase(unittest.TestCase):
+ 
+     @unittest.skipIf('SKIP_SLOW' in os.environ, 'Skipping slow test')
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_xmlrpc(self):
+         locator = PyPIRPCLocator(PYPI_RPC_HOST)
+         try:
+@@ -53,6 +54,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertGreater(len(names), 25000)
+ 
+     @unittest.skipIf('SKIP_SLOW' in os.environ, 'Skipping slow test')
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_json(self):
+         locator = PyPIJSONLocator(PYPI_RPC_HOST)
+         result = locator.get_project('sarge')
+@@ -69,6 +71,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertRaises(NotImplementedError, locator.get_distribution_names)
+ 
+     @unittest.skipIf('SKIP_SLOW' in os.environ, 'Skipping slow test')
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_scraper(self):
+         locator = SimpleScrapingLocator('https://pypi.python.org/simple/')
+         for name in ('sarge', 'Sarge'):
+@@ -88,6 +91,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertGreater(len(names), 25000)
+ 
+     @unittest.skipIf('SKIP_SLOW' in os.environ, 'Skipping slow test')
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_unicode_project_name(self):
+         # Just checking to see that no exceptions are raised.
+         NAME = '\u2603'
+@@ -166,6 +170,7 @@ class LocatorTestCase(unittest.TestCase):
+             sys.path.pop(0)
+ 
+     @unittest.skipIf('SKIP_SLOW' in os.environ, 'Skipping slow test')
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_aggregation(self):
+         d = os.path.join(HERE, 'fake_archives')
+         loc1 = DirectoryLocator(d)
+@@ -201,6 +206,7 @@ class LocatorTestCase(unittest.TestCase):
+         n2 = loc2.get_distribution_names()
+         self.assertEqual(locator.get_distribution_names(), n1 | n2)
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_dependency_finder(self):
+         locator = AggregatingLocator(
+             JSONLocator(),
+@@ -280,6 +286,7 @@ class LocatorTestCase(unittest.TestCase):
+         for url1, url2 in cases:
+             self.assertEqual(default_locator.prefer_url(url1, url2), url1)
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_prereleases(self):
+         locator = AggregatingLocator(
+             JSONLocator(),
+@@ -308,6 +315,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertEqual(dists, set([actual[0], dist]))
+         self.assertFalse(problems)
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_dist_reqts(self):
+         r = 'config (<=0.3.5)'
+         dist = default_locator.locate(r)
+@@ -316,6 +324,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertTrue(dist.matches_requirement(r))
+         self.assertFalse(dist.matches_requirement('config (0.3.6)'))
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_dist_reqts_extras(self):
+         r = 'config[doc,test](<=0.3.5)'
+         dist = default_locator.locate(r)
+@@ -323,6 +332,7 @@ class LocatorTestCase(unittest.TestCase):
+         self.assertTrue(dist.matches_requirement(r))
+         self.assertEqual(dist.extras, ['doc', 'test'])
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_all(self):
+         d = default_locator.get_project('setuptools')
+         self.assertTrue('urls' in d)
+diff --git a/tests/test_util.py b/tests/test_util.py
+index 1b615d7..2908eee 100644
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -461,6 +461,7 @@ class UtilTestCase(unittest.TestCase):
+         self.assertFalse(is_string_sequence(['a', 'b', None]))
+         self.assertRaises(AssertionError, is_string_sequence, [])
+ 
++    @unittest.skipIf('SKIP_ONLINE' in os.environ, 'Skipping online tests')
+     def test_package_data(self):
+         data = get_package_data(name='config', version='0.3.6')
+         self.assertTrue(data)

Reply via email to