Run build.py itself on the copy in the second-build thumbnail test, without removing it first, and check that a thumbnail taken away is put back and that no trail was worked out again
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2be6693a94
commit
0bb20c60dd
1 file changed
+9
-1
@@ -3,6 +3,7 @@ import contextlib
|
|||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
@@ -198,7 +199,14 @@ class BuiltPagesTest(unittest.TestCase):
|
|||||||
with tempfile.TemporaryDirectory() as tmp:
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
again = os.path.join(tmp, "site")
|
again = os.path.join(tmp, "site")
|
||||||
shutil.copytree(OUT, again)
|
shutil.copytree(OUT, again)
|
||||||
builtsite.build(again)
|
gone = os.path.join(again, "trails", self.png[0], thumbs.THUMB_NAME)
|
||||||
|
os.remove(gone) # one the second build must put back
|
||||||
|
# build.py itself, on the copy as it stands: builtsite.build removes its target first
|
||||||
|
done = subprocess.run([sys.executable, os.path.join(builtsite.WEB, "build.py"), "--out", again],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
|
self.assertEqual(done.returncode, 0, done.stderr[-2000:])
|
||||||
|
self.assertIn("trails processed 0,", done.stdout) # it was a second build, not a first
|
||||||
|
self.assertTrue(os.path.isfile(gone))
|
||||||
for tid in self.png:
|
for tid in self.png:
|
||||||
self.assertTrue(os.path.isfile(os.path.join(again, "trails", tid, thumbs.THUMB_NAME)), tid)
|
self.assertTrue(os.path.isfile(os.path.join(again, "trails", tid, thumbs.THUMB_NAME)), tid)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user