2e566a5b2e
- Update to 4.3.0: * Remove my\_ip from generated wsgi script * Fix typo in contribution instructions * Add release note for fix to bug 1786306 * Move pbr-installation jobs in-tree * Support subdirectory in the url * remove pypy jobs * add lib-forward-testing-python3 test job * add python 3.6 unit test job * switch documentation job to new PTI * import zuul job settings from project-config * Ignore Zuul when generating AUTHORS * tox: Re-add cover target - Add new_wheel.patch to make compatible with wheel = 0.32.1 OBS-URL: https://build.opensuse.org/request/show/642395 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pbr?expand=0&rev=101
60 lines
2.4 KiB
Diff
60 lines
2.4 KiB
Diff
--- a/pbr/tests/test_packaging.py
|
|
+++ b/pbr/tests/test_packaging.py
|
|
@@ -41,6 +41,7 @@
|
|
import email
|
|
import email.errors
|
|
import imp
|
|
+import logging
|
|
import os
|
|
import re
|
|
import sys
|
|
@@ -56,8 +57,11 @@ import testscenarios
|
|
import testtools
|
|
from testtools import matchers
|
|
import virtualenv
|
|
-import wheel.install
|
|
+try:
|
|
+ from wheel.install import WheelFile
|
|
+except ImportError:
|
|
+ from wheel.wheelfile import WheelFile
|
|
|
|
from pbr import git
|
|
from pbr import packaging
|
|
from pbr.tests import base
|
|
@@ -372,13 +376,15 @@ class TestPackagingWheels(base.BaseTestC
|
|
relative_wheel_filename = os.listdir(dist_dir)[0]
|
|
absolute_wheel_filename = os.path.join(
|
|
dist_dir, relative_wheel_filename)
|
|
- wheel_file = wheel.install.WheelFile(absolute_wheel_filename)
|
|
- wheel_name = wheel_file.parsed_filename.group('namever')
|
|
- # Create a directory path to unpack the wheel to
|
|
- self.extracted_wheel_dir = os.path.join(dist_dir, wheel_name)
|
|
- # Extract the wheel contents to the directory we just created
|
|
- wheel_file.zipfile.extractall(self.extracted_wheel_dir)
|
|
- wheel_file.zipfile.close()
|
|
+ with WheelFile(absolute_wheel_filename) as wheel_file:
|
|
+ wheel_name = wheel_file.parsed_filename.group('namever')
|
|
+ # Create a directory path to unpack the wheel to
|
|
+ self.extracted_wheel_dir = os.path.join(dist_dir, wheel_name)
|
|
+ # Extract the wheel contents to the directory we just created
|
|
+ if hasattr(wheel_file, 'zipfile'):
|
|
+ wheel_file.zipfile.extractall(self.extracted_wheel_dir)
|
|
+ else:
|
|
+ wheel_file.extractall(self.extracted_wheel_dir)
|
|
|
|
def test_data_directory_has_wsgi_scripts(self):
|
|
# Build the path to the scripts directory
|
|
@@ -402,8 +409,10 @@ class TestPackagingWheels(base.BaseTestC
|
|
static_object_path = os.path.join(
|
|
built_package_dir, static_object_filename)
|
|
|
|
- self.assertTrue(os.path.exists(built_package_dir))
|
|
- self.assertTrue(os.path.exists(static_object_path))
|
|
+ self.assertTrue(os.path.exists(built_package_dir),
|
|
+ 'built_package_dir %s not found!' % built_package_dir)
|
|
+ self.assertTrue(os.path.exists(static_object_path),
|
|
+ 'static_object_path %s not found!' % static_object_path)
|
|
|
|
|
|
class TestPackagingHelpers(testtools.TestCase):
|