From 5659f9b8a624df9c2751b50a6df087f92b34880c Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 1 Sep 2022 19:41:09 +0200 Subject: [PATCH 1/4] Move coverage config to pyproject.toml --- .coveragerc | 17 ----------------- pyproject.toml | 16 ++++++++++++++++ tox.ini | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 2fbbee1a..00000000 --- a/.coveragerc +++ /dev/null @@ -1,17 +0,0 @@ -[run] -source = - towncrier -branch = True - -[paths] -source = - src/ - .tox/*/lib/python*/site-packages/ - .tox/pypy*/site-packages/ - -[report] -show_missing = true -skip_covered = true -omit = - src/towncrier/__main__.py - src/towncrier/test/* diff --git a/pyproject.toml b/pyproject.toml index 9f13d8db..b7a31f45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,3 +66,19 @@ requires = [ "incremental == 17.5.0", ] build-backend = "setuptools.build_meta" + +[tool.coverage.run] +parallel = true +branch = true +source = ["towncrier"] + +[tool.coverage.paths] +source = ["src", ".tox/*/site-packages"] + +[tool.coverage.report] +show_missing = true +skip_covered = true +omit = [ + "src/towncrier/__main__.py", + "src/towncrier/test/*", +] diff --git a/tox.ini b/tox.ini index f2d4bed5..b569d967 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ commands = check-manifest [testenv] deps = Twisted - coverage + coverage[toml] incremental commands = From ac05366411782b8cbbeb134b96604c8fe615813d Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Thu, 1 Sep 2022 19:53:03 +0200 Subject: [PATCH 2/4] Add test for build called w/o a date --- src/towncrier/test/test_build.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/towncrier/test/test_build.py b/src/towncrier/test/test_build.py index 04817373..0e22f994 100644 --- a/src/towncrier/test/test_build.py +++ b/src/towncrier/test/test_build.py @@ -3,6 +3,7 @@ import os +from datetime import date from pathlib import Path from subprocess import call from textwrap import dedent @@ -280,6 +281,33 @@ def run_order_scenario(sections, types): ), ) + def test_draft_no_date(self): + """ + If no date is passed, today's date is used. + """ + runner = CliRunner() + + with runner.isolated_filesystem(): + setup_simple_project() + fragment_path1 = "foo/newsfragments/123.feature" + fragment_path2 = "foo/newsfragments/124.feature.rst" + with open(fragment_path1, "w") as f: + f.write("Adds levitation") + with open(fragment_path2, "w") as f: + f.write("Extends levitation") + + call(["git", "init"]) + call(["git", "config", "user.name", "user"]) + call(["git", "config", "user.email", "user@example.com"]) + call(["git", "add", "."]) + call(["git", "commit", "-m", "Initial Commit"]) + + today = date.today() + result = runner.invoke(_main, ["--draft"]) + + self.assertEqual(0, result.exit_code) + self.assertIn(f"Foo 1.2.3 ({today.isoformat()})", result.output) + def test_no_confirmation(self): runner = CliRunner() From f5da731a5d095cd8cabe01c04cbabed09f846a7d Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 2 Sep 2022 06:35:35 +0200 Subject: [PATCH 3/4] Add newsfragment --- src/towncrier/newsfragments/416.misc | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/towncrier/newsfragments/416.misc diff --git a/src/towncrier/newsfragments/416.misc b/src/towncrier/newsfragments/416.misc new file mode 100644 index 00000000..e69de29b From 28bcb3fed80a17b6db15083236b431f86f4c0e9e Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 2 Sep 2022 11:22:23 +0200 Subject: [PATCH 4/4] Fix ci --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 348275dd..b7c0eb71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: python-version: ${{ matrix.python.action }} - name: Install dependencies - run: python -m pip install --upgrade pip tox codecov + run: python -m pip install --upgrade pip tox codecov coverage[toml] - uses: twisted/python-info-action@v1 @@ -139,7 +139,7 @@ jobs: python-version: ${{ matrix.python.action }} - name: Install dependencies - run: python -m pip install --upgrade pip tox codecov + run: python -m pip install --upgrade pip tox codecov coverage[toml] - uses: twisted/python-info-action@v1