diff options
Diffstat (limited to 'tests/format')
15 files changed, 130 insertions, 0 deletions
diff --git a/tests/format/include.py b/tests/format/include.py index 3e7e0abf0..c64753be5 100644 --- a/tests/format/include.py +++ b/tests/format/include.py @@ -252,3 +252,61 @@ def test_local_to_junction(cli, tmpdir, datafiles): result.assert_success() loaded = _yaml.load_data(result.output) assert loaded.get_bool("included") + + +@pytest.mark.datafiles(DATA_DIR) +def test_option_from_junction(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), "junction_options") + + generate_junction( + tmpdir, + os.path.join(project, "subproject"), + os.path.join(project, "junction.bst"), + store_ref=True, + options={"local_option": "set"}, + ) + + result = cli.run(project=project, args=["show", "--deps", "none", "--format", "%{vars}", "element.bst"]) + result.assert_success() + loaded = _yaml.load_data(result.output) + assert not loaded.get_bool("is-default") + + +@pytest.mark.datafiles(DATA_DIR) +def test_option_from_junction_element(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), "junction_options_element") + + generate_junction( + tmpdir, + os.path.join(project, "subproject"), + os.path.join(project, "junction.bst"), + store_ref=True, + options={"local_option": "set"}, + ) + + result = cli.run(project=project, args=["show", "--deps", "none", "--format", "%{vars}", "element.bst"]) + result.assert_success() + loaded = _yaml.load_data(result.output) + assert not loaded.get_bool("is-default") + + +@pytest.mark.datafiles(DATA_DIR) +def test_option_from_deep_junction(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), "junction_options_deep") + + generate_junction( + tmpdir, + os.path.join(project, "subproject-2"), + os.path.join(project, "subproject-1", "junction-2.bst"), + store_ref=True, + options={"local_option": "set"}, + ) + + generate_junction( + tmpdir, os.path.join(project, "subproject-1"), os.path.join(project, "junction-1.bst"), store_ref=True, + ) + + result = cli.run(project=project, args=["show", "--deps", "none", "--format", "%{vars}", "element.bst"]) + result.assert_success() + loaded = _yaml.load_data(result.output) + assert not loaded.get_bool("is-default") diff --git a/tests/format/include/junction_options/element.bst b/tests/format/include/junction_options/element.bst new file mode 100644 index 000000000..4d7f70266 --- /dev/null +++ b/tests/format/include/junction_options/element.bst @@ -0,0 +1 @@ +kind: manual diff --git a/tests/format/include/junction_options/project.conf b/tests/format/include/junction_options/project.conf new file mode 100644 index 000000000..4836c5f8b --- /dev/null +++ b/tests/format/include/junction_options/project.conf @@ -0,0 +1,4 @@ +name: test + +(@): + - junction.bst:extra_conf.yml diff --git a/tests/format/include/junction_options/subproject/extra_conf.yml b/tests/format/include/junction_options/subproject/extra_conf.yml new file mode 100644 index 000000000..1edbeee36 --- /dev/null +++ b/tests/format/include/junction_options/subproject/extra_conf.yml @@ -0,0 +1,7 @@ +(?): +- local_option == 'default': + variables: + is-default: 'True' +- local_option == 'set': + variables: + is-default: 'False' diff --git a/tests/format/include/junction_options/subproject/project.conf b/tests/format/include/junction_options/subproject/project.conf new file mode 100644 index 000000000..33ab0c8af --- /dev/null +++ b/tests/format/include/junction_options/subproject/project.conf @@ -0,0 +1,11 @@ +name: test-sub + +options: + local_option: + type: enum + description: Testing + variable: local_option + default: default + values: + - default + - set diff --git a/tests/format/include/junction_options_deep/element.bst b/tests/format/include/junction_options_deep/element.bst new file mode 100644 index 000000000..4d7f70266 --- /dev/null +++ b/tests/format/include/junction_options_deep/element.bst @@ -0,0 +1 @@ +kind: manual diff --git a/tests/format/include/junction_options_deep/project.conf b/tests/format/include/junction_options_deep/project.conf new file mode 100644 index 000000000..2525081ce --- /dev/null +++ b/tests/format/include/junction_options_deep/project.conf @@ -0,0 +1,4 @@ +name: test + +(@): + - junction-1.bst:extra_conf.yml diff --git a/tests/format/include/junction_options_deep/subproject-1/extra_conf.yml b/tests/format/include/junction_options_deep/subproject-1/extra_conf.yml new file mode 100644 index 000000000..faa1a40f7 --- /dev/null +++ b/tests/format/include/junction_options_deep/subproject-1/extra_conf.yml @@ -0,0 +1,2 @@ +(@): + junction-2.bst:extra_conf.yml diff --git a/tests/format/include/junction_options_deep/subproject-1/project.conf b/tests/format/include/junction_options_deep/subproject-1/project.conf new file mode 100644 index 000000000..f0cd28202 --- /dev/null +++ b/tests/format/include/junction_options_deep/subproject-1/project.conf @@ -0,0 +1 @@ +name: test-sub-1 diff --git a/tests/format/include/junction_options_deep/subproject-2/extra_conf.yml b/tests/format/include/junction_options_deep/subproject-2/extra_conf.yml new file mode 100644 index 000000000..1edbeee36 --- /dev/null +++ b/tests/format/include/junction_options_deep/subproject-2/extra_conf.yml @@ -0,0 +1,7 @@ +(?): +- local_option == 'default': + variables: + is-default: 'True' +- local_option == 'set': + variables: + is-default: 'False' diff --git a/tests/format/include/junction_options_deep/subproject-2/project.conf b/tests/format/include/junction_options_deep/subproject-2/project.conf new file mode 100644 index 000000000..d44ccd809 --- /dev/null +++ b/tests/format/include/junction_options_deep/subproject-2/project.conf @@ -0,0 +1,11 @@ +name: test-sub-2 + +options: + local_option: + type: enum + description: Testing + variable: local_option + default: default + values: + - default + - set diff --git a/tests/format/include/junction_options_element/element.bst b/tests/format/include/junction_options_element/element.bst new file mode 100644 index 000000000..c815951b6 --- /dev/null +++ b/tests/format/include/junction_options_element/element.bst @@ -0,0 +1,4 @@ +kind: manual + +(@): + - junction.bst:extra_conf.yml diff --git a/tests/format/include/junction_options_element/project.conf b/tests/format/include/junction_options_element/project.conf new file mode 100644 index 000000000..b32753625 --- /dev/null +++ b/tests/format/include/junction_options_element/project.conf @@ -0,0 +1 @@ +name: test diff --git a/tests/format/include/junction_options_element/subproject/extra_conf.yml b/tests/format/include/junction_options_element/subproject/extra_conf.yml new file mode 100644 index 000000000..1edbeee36 --- /dev/null +++ b/tests/format/include/junction_options_element/subproject/extra_conf.yml @@ -0,0 +1,7 @@ +(?): +- local_option == 'default': + variables: + is-default: 'True' +- local_option == 'set': + variables: + is-default: 'False' diff --git a/tests/format/include/junction_options_element/subproject/project.conf b/tests/format/include/junction_options_element/subproject/project.conf new file mode 100644 index 000000000..33ab0c8af --- /dev/null +++ b/tests/format/include/junction_options_element/subproject/project.conf @@ -0,0 +1,11 @@ +name: test-sub + +options: + local_option: + type: enum + description: Testing + variable: local_option + default: default + values: + - default + - set |