Skip to content
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

Bring Coverage of build.py to 100% #416

Merged
merged 5 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .coveragerc

This file was deleted.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*",
]
Empty file.
28 changes: 28 additions & 0 deletions src/towncrier/test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os

from datetime import date
from pathlib import Path
from subprocess import call
from textwrap import dedent
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ commands = check-manifest
[testenv]
deps =
Twisted
coverage
coverage[toml]
incremental

commands =
Expand Down