File: bw_apply_autoonly.py

package info (click to toggle)
bundlewrap 5.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,260 kB
  • sloc: python: 20,851; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,339 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from os.path import exists, join

from bundlewrap.utils.testing import host_os, make_repo, run


def test_only_bundle_with_dep(tmpdir):
    make_repo(
        tmpdir,
        bundles={
            "test": {
                'items': {
                    'files': {
                        join(str(tmpdir), "foo"): {
                            'content_type': 'any',
                            'needs': ["file:" + join(str(tmpdir), "bar")],
                        },
                    },
                },
            },
            "test2": {
                'items': {
                    'files': {
                        join(str(tmpdir), "bar"): {
                            'content_type': 'any',
                        },
                        join(str(tmpdir), "baz"): {
                            'content_type': 'any',
                        },
                    },
                },
            },
        },
        nodes={
            "localhost": {
                'bundles': ["test", "test2"],
                'os': host_os(),
            },
        },
    )

    stdout, stderr, rcode = run("bw apply -o bundle:test -- localhost", path=str(tmpdir))
    assert rcode == 0
    assert exists(join(str(tmpdir), "foo"))
    assert exists(join(str(tmpdir), "bar"))
    assert not exists(join(str(tmpdir), "baz"))