Example #1
0
    def test_drop(self):
        drop_dir = yield from rule.drop_files(self.cache, self.content_tree,
                                              ['b'])
        yield from shared.assert_tree_contents(self.cache, drop_dir, {
            'a': 'foo',
            COLON + 'd': 'baz'
        })

        drop_file = yield from rule.drop_files(self.cache, self.content_tree,
                                               ['a'])
        yield from shared.assert_tree_contents(self.cache, drop_file, {
            'b/c': 'bar',
            COLON + 'd': 'baz'
        })

        drop_colon = yield from rule.drop_files(self.cache, self.content_tree,
                                                [COLON + 'd'])
        yield from shared.assert_tree_contents(self.cache, drop_colon, {
            'a': 'foo',
            'b/c': 'bar'
        })

        globs = yield from rule.drop_files(self.cache, self.content_tree,
                                           ['**/c', '**/a'])
        yield from shared.assert_tree_contents(self.cache, globs,
                                               {COLON + 'd': 'baz'})
Example #2
0
    def test_pick(self):
        pick_dir = yield from rule.pick_files(self.cache, self.content_tree, ["b"])
        yield from shared.assert_tree_contents(self.cache, pick_dir, {"b/c": "bar"})

        pick_file = yield from rule.pick_files(self.cache, self.content_tree, ["a"])
        yield from shared.assert_tree_contents(self.cache, pick_file, {"a": "foo"})

        globs = yield from rule.pick_files(self.cache, self.content_tree, ["**/c", "**/a"])
        yield from shared.assert_tree_contents(self.cache, globs, {"a": "foo", "b/c": "bar"})
Example #3
0
 def test_move(self):
     # Same semantics as copy above. Also, make sure that move deletes move
     # sources, but does not delete sources that were overwritten by the
     # target of another move.
     moves = {'a': 'b', 'b': 'a'}
     tree = rule.move_files(self.cache, self.content_tree, moves)
     shared.assert_tree_contents(self.cache, tree, {
         'a/c': 'bar',
         'b/a': 'foo',
     })
Example #4
0
 def test_move(self):
     # Same semantics as copy above. Also, make sure that move deletes move
     # sources, but does not delete sources that were overwritten by the
     # target of another move.
     moves = {'a': 'b', 'b': 'a'}
     tree = rule.move_files(self.cache, self.content_tree, moves)
     shared.assert_tree_contents(self.cache, tree, {
         'a/c': 'bar',
         'b/a': 'foo',
     })
Example #5
0
 def test_copy(self):
     # A file copied into a directory should be placed into that directory.
     # A directory or file copied into a file should overwrite that file.
     copies = {'a': ['x', 'b', 'b/c'], 'b': ['a', 'y']}
     tree = rule.copy_files(self.cache, self.content_tree, copies)
     shared.assert_tree_contents(self.cache, tree, {
         'a/c': 'bar',
         'b/a': 'foo',
         'b/c': 'foo',
         'x':   'foo',
         'y/c': 'bar',
     })
Example #6
0
 def test_copy(self):
     # A file copied into a directory should be placed into that directory.
     # A directory or file copied into a file should overwrite that file.
     copies = {'a': ['x', 'b', 'b/c'], 'b': ['a', 'y']}
     tree = rule.copy_files(self.cache, self.content_tree, copies)
     shared.assert_tree_contents(self.cache, tree, {
         'a/c': 'bar',
         'b/a': 'foo',
         'b/c': 'foo',
         'x': 'foo',
         'y/c': 'bar',
     })
Example #7
0
    def test_pick(self):
        pick_dir = yield from rule.pick_files(
            self.cache, self.content_tree, ['b'])
        yield from shared.assert_tree_contents(
            self.cache, pick_dir, {'b/c': 'bar'})

        pick_file = yield from rule.pick_files(
            self.cache, self.content_tree, ['a'])
        yield from shared.assert_tree_contents(
            self.cache, pick_file, {'a': 'foo'})

        globs = yield from rule.pick_files(
            self.cache, self.content_tree, ['**/c', '**/a'])
        yield from shared.assert_tree_contents(
            self.cache, globs, {'a': 'foo', 'b/c': 'bar'})
Example #8
0
    def test_drop(self):
        drop_dir = yield from rule.drop_files(
            self.cache, self.content_tree, ['b'])
        yield from shared.assert_tree_contents(
            self.cache, drop_dir, {'a': 'foo'})

        drop_file = yield from rule.drop_files(
            self.cache, self.content_tree, ['a'])
        yield from shared.assert_tree_contents(
            self.cache, drop_file, {'b/c': 'bar'})

        globs = yield from rule.drop_files(
            self.cache, self.content_tree, ['**/c', '**/a'])
        yield from shared.assert_tree_contents(
            self.cache, globs, {})
Example #9
0
 def test_move(self):
     # Same semantics as copy above. Also, make sure that move deletes move
     # sources, but does not delete sources that were overwritten by the
     # target of another move.
     moves = {"a": "b", "b": "a"}
     tree = yield from rule.move_files(self.cache, self.content_tree, moves)
     yield from shared.assert_tree_contents(self.cache, tree, {"a/c": "bar", "b/a": "foo"})
Example #10
0
 def test_copy(self):
     # A file copied into a directory should be placed into that directory.
     # A directory or file copied into a file should overwrite that file.
     copies = {"a": ["x", "b", "b/c"], "b": ["a", "y"]}
     tree = yield from rule.copy_files(self.cache, self.content_tree, copies)
     yield from shared.assert_tree_contents(
         self.cache, tree, {"a/c": "bar", "b/a": "foo", "b/c": "foo", "x": "foo", "y/c": "bar"}
     )
Example #11
0
    def test_pick(self):
        pick_dir = yield from rule.pick_files(self.cache, self.content_tree,
                                              ['b'])
        yield from shared.assert_tree_contents(self.cache, pick_dir,
                                               {'b/c': 'bar'})

        pick_file = yield from rule.pick_files(self.cache, self.content_tree,
                                               ['a'])
        yield from shared.assert_tree_contents(self.cache, pick_file,
                                               {'a': 'foo'})

        pick_colon = yield from rule.pick_files(self.cache, self.content_tree,
                                                [COLON + 'd'])
        yield from shared.assert_tree_contents(self.cache, pick_colon,
                                               {COLON + 'd': 'baz'})

        globs = yield from rule.pick_files(self.cache, self.content_tree,
                                           ['**/c', '**/a'])
        yield from shared.assert_tree_contents(self.cache, globs, {
            'a': 'foo',
            'b/c': 'bar'
        })
Example #12
0
    def test_pick(self):
        pick_dir = rule.pick_files(self.cache, self.content_tree, ['b'])
        shared.assert_tree_contents(self.cache, pick_dir, {'b/c': 'bar'})

        pick_file = rule.pick_files(self.cache, self.content_tree, ['a'])
        shared.assert_tree_contents(self.cache, pick_file, {'a': 'foo'})

        globs = rule.pick_files(self.cache, self.content_tree,
                                ['**/c', '**/a'])
        shared.assert_tree_contents(self.cache, globs, {
            'a': 'foo',
            'b/c': 'bar'
        })
Example #13
0
 def test_export(self):
     b = yield from rule.get_export_tree(
         self.cache, self.content_tree, 'b')
     yield from shared.assert_tree_contents(self.cache, b, {'c': 'bar'})
Example #14
0
 def test_export(self):
     b = rule.get_export_tree(self.cache, self.content_tree, 'b')
     shared.assert_tree_contents(self.cache, b, {'c': 'bar'})
Example #15
0
 def test_export(self):
     b = yield from rule.get_export_tree(self.cache, self.content_tree, "b")
     yield from shared.assert_tree_contents(self.cache, b, {"c": "bar"})