1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00
apps/tools/readme_generator/tests/test_make_readme.py
2024-08-28 21:15:46 +02:00

42 lines
1.2 KiB
Python
Executable file

#!/usr/bin/env python3
import tempfile
import subprocess
from pathlib import Path
TEST_DIRECTORY = Path(__file__).resolve().parent
TEST_APP_NAME = "gotosocial_ynh"
TEST_APP_REPO = "https://github.com/yunohost-apps/gotosocial_ynh"
TEST_APP_COMMIT_ID = "8f788213b363a46a5b6faa8f844d86d4adac9446"
def test_running_make_readme():
with tempfile.TemporaryDirectory() as tempdir:
tempdir = Path(tempdir)
temporary_tested_app_directory = tempdir / TEST_APP_NAME
subprocess.check_call(
["git", "clone", "-q", TEST_APP_REPO, temporary_tested_app_directory]
)
subprocess.check_call(
["git", "checkout", "-q", TEST_APP_COMMIT_ID],
cwd=temporary_tested_app_directory,
)
# Now run test...
subprocess.check_call([
TEST_DIRECTORY.parent / "make_readme.py",
"--apps-dir", TEST_DIRECTORY.parent.parent,
temporary_tested_app_directory
])
assert (
open(TEST_DIRECTORY / "README.md").read()
== open(temporary_tested_app_directory / "README.md").read()
)
if __name__ == "__main__":
test_running_make_readme()