mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
* fix for adding newline * added test to ensure fix #925
This commit is contained in:
committed by
Nate Prewitt
parent
eda2dba5b8
commit
9c4b68605c
+3
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user