1
0
Fork 0
ynh-apps_tools/readme_generator/tests/test_make_readme.py

38 lines
1,005 B
Python
Raw Normal View History

2024-03-08 05:10:47 +01:00
import os
import tempfile
import subprocess
from pathlib import Path
CWD = Path(os.path.split(os.path.realpath(__file__))[0])
COMMIT_ID = "8f788213b363a46a5b6faa8f844d86d4adac9446"
def test_running_make_readme():
with tempfile.TemporaryDirectory() as name:
name = Path(name)
DIRECTORY = name / "gotosocial_ynh"
2024-03-11 17:34:33 +01:00
subprocess.check_call(
[
"git",
"clone",
"https://github.com/yunohost-apps/gotosocial_ynh",
DIRECTORY,
"-q",
]
)
2024-03-08 05:10:47 +01:00
subprocess.check_call(["git", "checkout", COMMIT_ID, "-q"], cwd=DIRECTORY)
print(CWD)
subprocess.check_call([CWD / "../make_readme.py", DIRECTORY])
assert open(CWD / "README.md").read() == open(DIRECTORY / "README.md").read()
2024-03-11 17:34:33 +01:00
assert (
open(CWD / "README_fr.md").read() == open(DIRECTORY / "README_fr.md").read()
)
2024-03-08 05:10:47 +01:00
2024-03-11 17:34:33 +01:00
if __name__ == "__main__":
2024-03-08 05:10:47 +01:00
test_running_make_readme()