summaryrefslogtreecommitdiff
path: root/morphlib/artifactresolver_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/artifactresolver_tests.py')
-rw-r--r--morphlib/artifactresolver_tests.py97
1 files changed, 54 insertions, 43 deletions
diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py
index b958da4f..29718778 100644
--- a/morphlib/artifactresolver_tests.py
+++ b/morphlib/artifactresolver_tests.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Codethink Limited
+# Copyright (C) 2012-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
import itertools
import unittest
+import warnings
import yaml
import morphlib
@@ -158,8 +159,12 @@ class ArtifactResolverTests(unittest.TestCase):
for chunk in sources:
pool.add(chunk)
- morph = get_stratum_morphology(
- 'stratum', chunks=[('chunk', 'chunk', 'repo', 'ref')])
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+
+ morph = get_stratum_morphology(
+ 'stratum', chunks=[('chunk', 'chunk', 'repo', 'ref')])
+
stratum_sources = set(morphlib.source.make_sources('repo', 'ref',
'stratum.morph',
'sha1', 'tree',
@@ -250,30 +255,33 @@ class ArtifactResolverTests(unittest.TestCase):
'repo', 'original/ref', 'chunk1.morph', 'sha1', 'tree', chunk)
pool.add(chunk1)
- morph = get_stratum_morphology(
- 'stratum1',
- chunks=[(loader.save_to_string(chunk), 'chunk1.morph',
- 'repo', 'original/ref')],
- build_depends=['stratum2'])
- sources = morphlib.source.make_sources('repo', 'original/ref',
- 'stratum1.morph', 'sha1',
- 'tree', morph)
- for stratum1 in sources:
- pool.add(stratum1)
-
- chunk = get_chunk_morphology('chunk2')
- chunk2, = morphlib.source.make_sources(
- 'repo', 'original/ref', 'chunk2.morph', 'sha1', 'tree', chunk)
- pool.add(chunk2)
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+
+ morph = get_stratum_morphology(
+ 'stratum1',
+ chunks=[(loader.save_to_string(chunk), 'chunk1.morph',
+ 'repo', 'original/ref')],
+ build_depends=['stratum2'])
+ sources = morphlib.source.make_sources('repo', 'original/ref',
+ 'stratum1.morph', 'sha1',
+ 'tree', morph)
+ for stratum1 in sources:
+ pool.add(stratum1)
+
+ chunk = get_chunk_morphology('chunk2')
+ chunk2, = morphlib.source.make_sources(
+ 'repo', 'original/ref', 'chunk2.morph', 'sha1', 'tree', chunk)
+ pool.add(chunk2)
- morph = get_stratum_morphology(
- 'stratum2',
- chunks=[(loader.save_to_string(chunk), 'chunk2.morph',
- 'repo', 'original/ref')],
- build_depends=['stratum1'])
- sources = morphlib.source.make_sources('repo', 'original/ref',
- 'stratum2.morph', 'sha1',
- 'tree', morph)
+ morph = get_stratum_morphology(
+ 'stratum2',
+ chunks=[(loader.save_to_string(chunk), 'chunk2.morph',
+ 'repo', 'original/ref')],
+ build_depends=['stratum1'])
+ sources = morphlib.source.make_sources('repo', 'original/ref',
+ 'stratum2.morph', 'sha1',
+ 'tree', morph)
for stratum2 in sources:
pool.add(stratum2)
@@ -283,23 +291,26 @@ class ArtifactResolverTests(unittest.TestCase):
def test_detection_of_chunk_dependencies_in_invalid_order(self):
pool = morphlib.sourcepool.SourcePool()
- loader = morphlib.morphloader.MorphologyLoader()
- morph = loader.load_from_string(
- '''
- name: stratum
- kind: stratum
- build-depends: []
- chunks:
- - name: chunk1
- repo: repo
- ref: original/ref
- build-depends:
- - chunk2
- - name: chunk2
- repo: repo
- ref: original/ref
- build-depends: []
- ''')
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ loader = morphlib.morphloader.MorphologyLoader()
+ morph = loader.load_from_string(
+ '''
+ name: stratum
+ kind: stratum
+ build-depends: []
+ chunks:
+ - name: chunk1
+ repo: repo
+ ref: original/ref
+ build-depends:
+ - chunk2
+ - name: chunk2
+ repo: repo
+ ref: original/ref
+ build-depends: []
+ ''')
+
sources = morphlib.source.make_sources('repo', 'original/ref',
'stratum.morph', 'sha1',
'tree', morph)