* fix for adding newline

* added test to ensure fix #925
This commit is contained in:
Hamad AlGhanim
2017-10-18 10:07:17 -07:00
committed by Nate Prewitt
parent eda2dba5b8
commit 9c4b68605c
2 changed files with 21 additions and 1 deletions
+3 -1
View File
@@ -290,7 +290,9 @@ def cleanup_toml(tml):
# Insert a newline after the heading.
if after:
new_toml.append('')
# adding new line at the end of the TOML file
new_toml.append('')
toml = '\n'.join(new_toml)
return toml
+18
View File
@@ -186,3 +186,21 @@ class TestUtils:
pipenv.utils.download_file(url, output)
assert os.path.exists(output)
os.remove(output)
def test_new_line_end_of_toml_file(this):
# toml file that needs clean up
toml = """
[dev-packages]
"flake8" = ">=3.3.0,<4"
pytest = "*"
mock = "*"
sphinx = "<=1.5.5"
"-e ." = "*"
twine = "*"
"sphinx-click" = "*"
"pytest-xdist" = "*"
"""
new_toml = pipenv.utils.cleanup_toml(toml)
# testing if the end of the generated file contains a newline
assert new_toml[-1] == '\n'