mirror of
https://github.com/rendercv/rendercv.git
synced 2025-12-23 21:47:55 -05:00
Improve the documentation
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import contextlib
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -12,15 +16,36 @@ import pytest
|
||||
"precommit",
|
||||
"update-schema",
|
||||
"update-examples",
|
||||
"create-executable",
|
||||
"docs:build",
|
||||
"docs:update-entry-figures",
|
||||
],
|
||||
)
|
||||
def test_default_format(script_name):
|
||||
# Check if hatch is installed:
|
||||
try:
|
||||
subprocess.run(["hatch", "--version"], check=True)
|
||||
def test_scripts(script_name):
|
||||
# If hatch is not installed, just pass the test
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
subprocess.run(["hatch", "run", script_name], check=True)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
def test_executable():
|
||||
# If hatch is not installed, just pass the test
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
root = pathlib.Path(__file__).parent.parent
|
||||
bin_folder = root / "bin"
|
||||
# remove the bin folder if it exists
|
||||
if bin_folder.exists():
|
||||
for file in bin_folder.iterdir():
|
||||
file.unlink()
|
||||
bin_folder.rmdir()
|
||||
|
||||
subprocess.run(["hatch", "run", "exe:create"], check=True)
|
||||
|
||||
executable_path = next(bin_folder.iterdir())
|
||||
assert executable_path.is_file()
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
subprocess.run([str(executable_path), "new", "John"], check=True)
|
||||
subprocess.run([str(executable_path), "render", "John_CV.yaml"], check=True)
|
||||
pdf_path = pathlib.Path(temp_dir) / "rendercv_output" / "John_CV.pdf"
|
||||
|
||||
assert pdf_path.exists()
|
||||
|
||||
Reference in New Issue
Block a user