Skip to content

Commit

Permalink
remove hardcoded "temp" subdir between work and _dist and _build
Browse files Browse the repository at this point in the history
  • Loading branch information
Krande committed Jan 18, 2024
1 parent b4008d2 commit d23255a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/paradoc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def __init__(
clean_build_dir=True,
create_dirs=False,
output_dir=None,
work_dir=None,
work_dir="temp",
use_default_html_style=True,
**kwargs,
):
self.source_dir = pathlib.Path().resolve().absolute() if source_dir is None else pathlib.Path(source_dir)
self.work_dir = pathlib.Path(work_dir).resolve().absolute() if work_dir is not None else pathlib.Path("")
self.work_dir = pathlib.Path(work_dir).resolve().absolute()
self.work_dir = self.work_dir.resolve().absolute()

self._main_prefix = main_prefix
Expand Down Expand Up @@ -300,11 +300,11 @@ def app_dir(self):

@property
def build_dir(self):
return self.work_dir / "temp" / "_build"
return self.work_dir / "_build"

@property
def dist_dir(self):
return self.work_dir / "temp" / "_dist"
return self.work_dir / "_dist"

@property
def output_dir(self):
Expand Down
19 changes: 13 additions & 6 deletions tests/base_doc/test_table_of_contents.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import pytest

from paradoc import MY_DOCX_TMPL_BLANK, OneDoc


def test_no_toc(test_dir):
o = OneDoc("temp/no_toc", work_dir=test_dir, create_dirs=True)
@pytest.fixture
def test_output_dir(test_dir):
return test_dir / "toc"


def test_no_toc(test_output_dir):
o = OneDoc("temp/no_toc", work_dir=test_output_dir / "no_toc", create_dirs=True)
o.compile("no_toc", main_tmpl=MY_DOCX_TMPL_BLANK)


def test_just_toc_has_toc(test_dir):
o = OneDoc("temp/just_toc", work_dir=test_dir, create_dirs=True)
def test_just_toc_has_toc(test_output_dir):
o = OneDoc("temp/just_toc", work_dir=test_output_dir / "just_toc", create_dirs=True)
o.compile("just_toc")


def test_has_toc(test_dir, files_dir):
o = OneDoc(files_dir / "toc", work_dir=test_dir, create_dirs=True)
def test_has_toc(test_output_dir, files_dir):
o = OneDoc(files_dir / "toc", work_dir=test_output_dir / "has_toc", create_dirs=True)
o.compile("heading_toc_just_toc")

0 comments on commit d23255a

Please sign in to comment.