Consolidate test site fixture into a single make_site
This commit is contained in:
+15
-3
@@ -1,8 +1,20 @@
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
from omicron.ssg.site import Site
|
||||
|
||||
DATA_SITES = Path(__file__).parent.parent / "data" / "sites"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def thin_site(tmp_path):
|
||||
(tmp_path / "config.yml").write_text("name: test\ntemplate: plain\n")
|
||||
return Site(tmp_path)
|
||||
def make_site(tmp_path):
|
||||
def _make(name, **kwargs):
|
||||
site_dir = tmp_path / name
|
||||
shutil.copytree(
|
||||
DATA_SITES / name,
|
||||
site_dir,
|
||||
ignore=shutil.ignore_patterns("output", "build.log"),
|
||||
)
|
||||
return Site(site_dir, **kwargs)
|
||||
|
||||
return _make
|
||||
|
||||
Reference in New Issue
Block a user