From 2b81b5df63cb3427c1884b1fe7ed3d5eb70eea80 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 6 Sep 2018 14:06:07 -0400 Subject: [PATCH] Remove initialization duplication in tests --- src/towncrier/test/test_check.py | 34 ++------------------------------ 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/src/towncrier/test/test_check.py b/src/towncrier/test/test_check.py index 5a817dd9..d4d7c39d 100644 --- a/src/towncrier/test/test_check.py +++ b/src/towncrier/test/test_check.py @@ -84,22 +84,7 @@ def test_fragment_exists(self): runner = CliRunner() with runner.isolated_filesystem(): - with open("pyproject.toml", "w") as f: - f.write("[tool.towncrier]\n" 'package = "foo"\n') - os.mkdir("foo") - with open("foo/__init__.py", "w") as f: - f.write('__version__ = "1.2.3"\n') - os.mkdir("foo/newsfragments") - fragment_path = "foo/newsfragments/123.feature" - with open(fragment_path, "w") as f: - f.write("Adds 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"]) - call(["git", "checkout", "-b", "otherbranch"]) + create_project("pyproject.toml") file_path = "foo/somefile.py" with open(file_path, "w") as f: @@ -133,22 +118,7 @@ def test_fragment_missing(self): runner = CliRunner() with runner.isolated_filesystem(): - with open("pyproject.toml", "w") as f: - f.write("[tool.towncrier]\n" 'package = "foo"\n') - os.mkdir("foo") - with open("foo/__init__.py", "w") as f: - f.write('__version__ = "1.2.3"\n') - os.mkdir("foo/newsfragments") - fragment_path = "foo/newsfragments/123.feature" - with open(fragment_path, "w") as f: - f.write("Adds 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"]) - call(["git", "checkout", "-b", "otherbranch"]) + create_project("pyproject.toml") file_path = "foo/somefile.py" with open(file_path, "w") as f: