Commit 3de46334 authored by Julien Muchembled's avatar Julien Muchembled

Fix tests

parent a76ec7be
This diff is collapsed.
...@@ -328,24 +328,15 @@ class NonInformativeTests(unittest.TestCase): ...@@ -328,24 +328,15 @@ class NonInformativeTests(unittest.TestCase):
self.assertTrue(os.path.exists(build_directory)) self.assertTrue(os.path.exists(build_directory))
def test_suite(): def test_suite():
# Hash used in the test depend on the file:// url of the package, so sums = []
# we use re-normalizer to replace SHARED_PACKAGE_HASH with the actual def md5sum(m):
# hash for this path. x = m.group(0)
package_url = 'file://%s/package-0.0.0.tar.gz' % os.path.join( try:
os.path.dirname(__file__), 'testdata') i = sums.index(x)
except ValueError:
signature_FIRST_SHARED_PACKAGE_HASH = Signature('.slapos.recipe.cmmi.signature') i = len(sums)
signature_FIRST_SHARED_PACKAGE_HASH.update('environment', 'FOO=bar') sums.append(x)
signature_FIRST_SHARED_PACKAGE_HASH.update('recipe', 'slapos.recipe.cmmi') return '<MD5SUM:%s>' % i
signature_FIRST_SHARED_PACKAGE_HASH.update('shared', 'True')
signature_FIRST_SHARED_PACKAGE_HASH.update('url', package_url)
signature_ANOTHER_SHARED_PACKAGE_HASH = Signature('.slapos.recipe.cmmi.signature')
signature_ANOTHER_SHARED_PACKAGE_HASH.update('change', 'True')
signature_ANOTHER_SHARED_PACKAGE_HASH.update('recipe', 'slapos.recipe.cmmi')
signature_ANOTHER_SHARED_PACKAGE_HASH.update('shared', 'True')
signature_ANOTHER_SHARED_PACKAGE_HASH.update('url', package_url)
suite = unittest.TestSuite(( suite = unittest.TestSuite((
doctest.DocFileSuite( doctest.DocFileSuite(
'README.rst', 'README.rst',
...@@ -361,10 +352,7 @@ def test_suite(): ...@@ -361,10 +352,7 @@ def test_suite():
'--prefix=/shared/'), '--prefix=/shared/'),
(re.compile(r'\s/\S+\/shared\/'), (re.compile(r'\s/\S+\/shared\/'),
' /shared/'), ' /shared/'),
(re.compile('FIRST_SHARED_PACKAGE_HASH'), (re.compile('[0-9a-f]{32}'), md5sum),
signature_FIRST_SHARED_PACKAGE_HASH.hexdigest()),
(re.compile('ANOTHER_SHARED_PACKAGE_HASH'),
signature_ANOTHER_SHARED_PACKAGE_HASH.hexdigest()),
# Normalize subprocess.CalledProcessError message, on python >= 3.6 # Normalize subprocess.CalledProcessError message, on python >= 3.6
# there's an extra . at the end. # there's an extra . at the end.
(re.compile(r'Command (.*) returned non-zero exit status (\d+)[\.]{0,1}'), (re.compile(r'Command (.*) returned non-zero exit status (\d+)[\.]{0,1}'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment