Merge pull request #6010 from pytest-dev/asottile-patch-2
Ensure .pytest_cache file has a newline at the end
This commit is contained in:
		
						commit
						b88f5df4ce
					
				| 
						 | 
					@ -135,7 +135,7 @@ class Cache:
 | 
				
			||||||
        readme_path.write_text(README_CONTENT)
 | 
					        readme_path.write_text(README_CONTENT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gitignore_path = self._cachedir.joinpath(".gitignore")
 | 
					        gitignore_path = self._cachedir.joinpath(".gitignore")
 | 
				
			||||||
        msg = "# Created by pytest automatically.\n*"
 | 
					        msg = "# Created by pytest automatically.\n*\n"
 | 
				
			||||||
        gitignore_path.write_text(msg, encoding="UTF-8")
 | 
					        gitignore_path.write_text(msg, encoding="UTF-8")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
 | 
					        cachedir_tag_path = self._cachedir.joinpath("CACHEDIR.TAG")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1029,7 +1029,7 @@ def test_gitignore(testdir):
 | 
				
			||||||
    config = testdir.parseconfig()
 | 
					    config = testdir.parseconfig()
 | 
				
			||||||
    cache = Cache.for_config(config)
 | 
					    cache = Cache.for_config(config)
 | 
				
			||||||
    cache.set("foo", "bar")
 | 
					    cache.set("foo", "bar")
 | 
				
			||||||
    msg = "# Created by pytest automatically.\n*"
 | 
					    msg = "# Created by pytest automatically.\n*\n"
 | 
				
			||||||
    gitignore_path = cache._cachedir.joinpath(".gitignore")
 | 
					    gitignore_path = cache._cachedir.joinpath(".gitignore")
 | 
				
			||||||
    assert gitignore_path.read_text(encoding="UTF-8") == msg
 | 
					    assert gitignore_path.read_text(encoding="UTF-8") == msg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue