2024-03-13 14:48:52 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2024-03-08 05:10:47 +01:00
|
|
|
import tempfile
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
2024-03-24 05:45:21 +01:00
|
|
|
TEST_DIRECTORY = Path(__file__).resolve().parent
|
2024-03-13 14:48:52 +01:00
|
|
|
|
|
|
|
TEST_APP_NAME = "gotosocial_ynh"
|
|
|
|
TEST_APP_REPO = "https://github.com/yunohost-apps/gotosocial_ynh"
|
|
|
|
TEST_APP_COMMIT_ID = "8f788213b363a46a5b6faa8f844d86d4adac9446"
|
|
|
|
|
2024-03-13 21:49:30 +01:00
|
|
|
|
2024-03-08 05:10:47 +01:00
|
|
|
def test_running_make_readme():
|
2024-03-13 14:48:52 +01:00
|
|
|
with tempfile.TemporaryDirectory() as tempdir:
|
|
|
|
tempdir = Path(tempdir)
|
2024-03-24 05:45:21 +01:00
|
|
|
temporary_tested_app_directory = tempdir / TEST_APP_NAME
|
2024-03-13 14:48:52 +01:00
|
|
|
|
2024-03-13 21:49:30 +01:00
|
|
|
subprocess.check_call(
|
2024-03-24 05:45:38 +01:00
|
|
|
["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,
|
2024-03-13 21:49:30 +01:00
|
|
|
)
|
2024-03-13 14:48:52 +01:00
|
|
|
|
|
|
|
# Now run test...
|
2024-03-24 05:45:38 +01:00
|
|
|
subprocess.check_call(
|
2024-08-11 22:55:33 +02:00
|
|
|
[
|
|
|
|
TEST_DIRECTORY.parent / "make_readme.py",
|
|
|
|
temporary_tested_app_directory,
|
|
|
|
]
|
2024-03-24 05:45:38 +01:00
|
|
|
)
|
2024-03-13 14:48:52 +01:00
|
|
|
|
2024-03-24 05:45:38 +01:00
|
|
|
assert (
|
|
|
|
open(TEST_DIRECTORY / "README.md").read()
|
|
|
|
== open(temporary_tested_app_directory / "README.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()
|