Skip to content

Commit

Permalink
Merge branch 'trunk' into git-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban authored Sep 2, 2022
2 parents 390ce3c + 64ef82d commit 8d3c5d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
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 @@ -303,6 +304,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", "[email protected]"])
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

0 comments on commit 8d3c5d1

Please sign in to comment.