diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2022-06-30 22:39:15 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2022-07-01 00:06:52 +0200 |
commit | 12bf18e6c39c8f3563aa5948b817eb31cc6b9859 (patch) | |
tree | 6047a842543e11ebdbd8173c59981b2068b65edd /testing | |
parent | 1b18371fc2fa672f39c758a103c4d12956b5964f (diff) | |
download | setuptools-scm-12bf18e6c39c8f3563aa5948b817eb31cc6b9859.tar.gz |
fix #738: protect relative_to of Configuration.from_file
users assumed it makes sense to use in the configfile,
where we actually have to use the config file name itself as ancor
Diffstat (limited to 'testing')
-rw-r--r-- | testing/test_config.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/test_config.py b/testing/test_config.py index d7aa3f4..97bb36e 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -51,3 +51,26 @@ def test_config_regex_init() -> None: tag_regex = re.compile(r"v(\d+)") conf = Configuration(tag_regex=tag_regex) assert conf.tag_regex is tag_regex + + +def test_config_from_file_protects_relative_to(tmp_path: Path) -> None: + fn = tmp_path / "pyproject.toml" + fn.write_text( + textwrap.dedent( + """ + [tool.setuptools_scm] + relative_to = "dont_use_me" + [project] + description = "Factory ⸻ A code generator 🏭" + authors = [{name = "Łukasz Langa"}] + """ + ), + encoding="utf-8", + ) + with pytest.warns( + UserWarning, + match=".*pyproject.toml: at \\[tool.setuptools_scm\\]\n" + "ignoring value relative_to='dont_use_me'" + " as its always relative to the config file", + ): + assert Configuration.from_file(str(fn)) |