-
Notifications
You must be signed in to change notification settings - Fork 129
Allowed fallback usage of project.name for name and package if pyproject.toml exists
#687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
205da9c
8f8c9f5
7eda8b3
45cc1bf
afe1f42
cfdb1f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Enabled fallback values of [tool.towncrier.name|package] to [project.name] if pyproject.toml files are used | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -112,22 +112,6 @@ def test_template_extended(self): | |||||
|
|
||||||
| self.assertEqual(config.template, ("towncrier.templates", "default.rst")) | ||||||
|
|
||||||
| def test_missing(self): | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this test removed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because now A The removed test checked that it broke when |
||||||
| """ | ||||||
| If the config file doesn't have the correct toml key, we error. | ||||||
| """ | ||||||
| project_dir = self.mktemp_project( | ||||||
| pyproject_toml=""" | ||||||
| [something.else] | ||||||
| blah='baz' | ||||||
| """ | ||||||
| ) | ||||||
|
|
||||||
| with self.assertRaises(ConfigError) as e: | ||||||
| load_config(project_dir) | ||||||
|
|
||||||
| self.assertEqual(e.exception.failing_option, "all") | ||||||
|
|
||||||
| def test_incorrect_single_file(self): | ||||||
| """ | ||||||
| single_file must be a bool. | ||||||
|
|
@@ -194,6 +178,42 @@ def test_towncrier_toml_preferred(self): | |||||
| config = load_config(project_dir) | ||||||
| self.assertEqual(config.package, "a") | ||||||
|
|
||||||
| def test_pyproject_name_fallback_both(self): | ||||||
| """ | ||||||
| Towncrier will fallback to the [project.name] value in pyproject.toml. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a small suggestion to help understand the scope of this test.
Suggested change
Just asking. Is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. When it is a Python project with a |
||||||
| """ | ||||||
| project_dir = self.mktemp_project( | ||||||
| pyproject_toml=""" | ||||||
| [project] | ||||||
| name = "a" | ||||||
| """, | ||||||
| ) | ||||||
|
|
||||||
| config = load_config(project_dir) | ||||||
| self.assertEqual(config.package, "a") | ||||||
| self.assertEqual(config.name, "a") | ||||||
|
|
||||||
| def test_pyproject_name_fallback_towncrier(self): | ||||||
| """ | ||||||
| Towncrier will fallback to the [project.name] value in pyproject.toml. | ||||||
|
adiroiban marked this conversation as resolved.
Outdated
|
||||||
| """ | ||||||
| project_dir = self.mktemp_project( | ||||||
| towncrier_toml=""" | ||||||
| [tool.towncrier] | ||||||
| package = "a" | ||||||
| """, | ||||||
| pyproject_toml=""" | ||||||
| [project] | ||||||
| name = "c" | ||||||
| [tool.towncrier] | ||||||
| name = "b" | ||||||
| """, | ||||||
| ) | ||||||
|
|
||||||
| config = load_config(project_dir) | ||||||
| self.assertEqual(config.package, "a") | ||||||
| self.assertEqual(config.name, "c") | ||||||
|
|
||||||
| @with_isolated_runner | ||||||
| def test_load_no_config(self, runner: CliRunner): | ||||||
| """ | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.