From 887937ba1ccff366d087668fdf39ecd4c6c18031 Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Mon, 8 May 2023 09:49:10 +1200 Subject: [PATCH] Simplify test and fragment --- src/towncrier/newsfragments/507.misc | 2 +- src/towncrier/test/test_build.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/towncrier/newsfragments/507.misc b/src/towncrier/newsfragments/507.misc index 14ed0e2e..b8f04783 100644 --- a/src/towncrier/newsfragments/507.misc +++ b/src/towncrier/newsfragments/507.misc @@ -1 +1 @@ -Provide a friendly message if --version option is required (for non-Python projects that don't explicitly provide the version in the config) +A friendly message is now provided, when it's necessary to pass the ``--version`` option explicitly. diff --git a/src/towncrier/test/test_build.py b/src/towncrier/test/test_build.py index 06689871..d4561263 100644 --- a/src/towncrier/test/test_build.py +++ b/src/towncrier/test/test_build.py @@ -517,9 +517,10 @@ def test_needs_version(self, runner: CliRunner): If the configuration file doesn't specify a version or a package, the version option is required. """ - with open("towncrier.toml", "w") as f: - f.write("[tool.towncrier]") + write("towncrier.toml", "[tool.towncrier]") + result = runner.invoke(_main, ["--draft"], catch_exceptions=False) + self.assertEqual(2, result.exit_code) self.assertIn("Error: '--version' is required", result.output)