Skip to content

Commit

Permalink
Remove initialization duplication in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Sep 6, 2018
1 parent aaf89f3 commit 2b81b5d
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/towncrier/test/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[email protected]"])
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:
Expand Down Expand Up @@ -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", "[email protected]"])
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:
Expand Down

0 comments on commit 2b81b5d

Please sign in to comment.