Skip to content

Commit

Permalink
add test coverage for the new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Sep 5, 2018
1 parent 5a8f88d commit baabb88
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/towncrier/test/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,26 @@ class TestChecker(TestCase):
maxDiff = None

def test_no_changes_made(self):
self._test_no_changes_made(
"pyproject.toml",
lambda runner, main, argv: runner.invoke(main, argv),
)

def test_no_changes_made_pyproject_path(self):
pyproject = "not-pyproject.toml"
self._test_no_changes_made(
pyproject,
lambda runner, main, argv: runner.invoke(
main,
argv + ["--pyproject", pyproject],
),
)

def _test_no_changes_made(self, pyproject_path, invoke):
runner = CliRunner()

with runner.isolated_filesystem():
with open("pyproject.toml", "w") as f:
with open(pyproject_path, "w") as f:
f.write("[tool.towncrier]\n" 'package = "foo"\n')
os.mkdir("foo")
with open("foo/__init__.py", "w") as f:
Expand All @@ -34,7 +50,7 @@ def test_no_changes_made(self):
call(["git", "commit", "-m", "Initial Commit"])
call(["git", "checkout", "-b", "otherbranch"])

result = runner.invoke(_main, ["--compare-with", "master"])
result = invoke(runner, _main, ["--compare-with", "master"])

self.assertEqual(0, result.exit_code)
self.assertEqual(
Expand Down

0 comments on commit baabb88

Please sign in to comment.