Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/ablog/tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ def test_not_safe_for_parallel_read(rootdir: Path, tmp_path: Path):
bad_read_safe = '"parallel_read_safe": True'
init_py_path = Path(__file__).parent.parent / "__init__.py"
assert good_read_safe in init_py_path.read_text(encoding="utf-8")
bad_init_py = init_py_path.read_text().replace(good_read_safe, bad_read_safe)
original_init_py = init_py_path.read_text(encoding="utf-8")
bad_init_py = original_init_py.replace(good_read_safe, bad_read_safe)
init_py_path.write_text(bad_init_py, encoding="utf-8")
try:
# liborjelinek: I wasn't able to demonstrate the issue with the `parallel` argument to the `sphinx` fixture
# @pytest.mark.sphinx("html", testroot="parallel", parallel=2)
# therefore running sphinx-build externally
indir = rootdir / "test-parallel"
run(["sphinx-build", "-b", "html", indir.as_posix(), tmp_path.as_posix(), "-j", "auto"], check=True)

# liborjelinek: I wasn't able to demonstrate the issue with the `parallel` argument to the `sphinx` fixture
# @pytest.mark.sphinx("html", testroot="parallel", parallel=2)
# therefore running sphinx-build externally
indir = rootdir / "test-parallel"
run(["sphinx-build", "-b", "html", indir.as_posix(), tmp_path.as_posix(), "-j", "auto"], check=True)

# And posts are not collected by Ablog...
html = (tmp_path / "postlist.html").read_text(encoding="utf-8")
assert "post 1" not in html
assert "post 2" not in html
assert "post 3" not in html
assert "post 4" not in html
# And posts are not collected by Ablog...
html = (tmp_path / "postlist.html").read_text(encoding="utf-8")
assert "post 1" not in html
assert "post 2" not in html
assert "post 3" not in html
assert "post 4" not in html
finally:
init_py_path.write_text(original_init_py, encoding="utf-8")
Loading