mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: ensure requirements files end on newline (#4761)
This commit is contained in:
19
test/general/test_requirements.py
Normal file
19
test/general/test_requirements.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import unittest
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class TestBase(unittest.TestCase):
|
||||||
|
def test_requirements_file_ends_on_newline(self):
|
||||||
|
"""Test that all requirements files end on a newline"""
|
||||||
|
import Utils
|
||||||
|
requirements_files = [Utils.local_path("requirements.txt"),
|
||||||
|
Utils.local_path("WebHostLib", "requirements.txt")]
|
||||||
|
worlds_path = Utils.local_path("worlds")
|
||||||
|
for entry in os.listdir(worlds_path):
|
||||||
|
requirements_path = os.path.join(worlds_path, entry, "requirements.txt")
|
||||||
|
if os.path.isfile(requirements_path):
|
||||||
|
requirements_files.append(requirements_path)
|
||||||
|
for requirements_file in requirements_files:
|
||||||
|
with self.subTest(path=requirements_file):
|
||||||
|
with open(requirements_file) as f:
|
||||||
|
self.assertEqual(f.read()[-1], "\n")
|
Reference in New Issue
Block a user