Skip to content

Commit

Permalink
🔐 Use a safe temporary directory for the test workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegerber committed Sep 15, 2022
1 parent 395e43c commit 9866b06
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test_recognize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import shutil
import subprocess
import tempfile
import urllib.request
from lxml import etree
from glob import glob
Expand All @@ -13,7 +14,7 @@
from .base import assets

METS_KANT = assets.url_of('kant_aufklaerung_1784-page-region-line-word_glyph/data/mets.xml')
WORKSPACE_DIR = '/tmp/test-ocrd-calamari'
WORKSPACE_DIR = tempfile.mkdtemp(prefix='test-ocrd-calamari-')
CHECKPOINT_DIR = os.getenv('MODEL')


Expand Down Expand Up @@ -80,7 +81,9 @@ def workspace():
tree.write(path, xml_declaration=True, encoding="utf-8")
assertFileDoesNotContain(path, "TextEquiv")

return workspace
yield workspace

shutil.rmtree(WORKSPACE_DIR)


def test_recognize(workspace):
Expand Down

0 comments on commit 9866b06

Please sign in to comment.