mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Remove temporary directories after failed tests
This commit is contained in:
parent
f64b5bf737
commit
ab908fee43
@ -4,6 +4,7 @@ import shutil
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from shutil import rmtree
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
@ -14,6 +15,19 @@ from django.conf import settings
|
|||||||
|
|
||||||
|
|
||||||
class TestDate(TestCase):
|
class TestDate(TestCase):
|
||||||
|
def tearDown(self):
|
||||||
|
# Delete all temporary directories from failed tests
|
||||||
|
root = os.path.normpath("/tmp")
|
||||||
|
|
||||||
|
for filename in os.listdir(root):
|
||||||
|
fullname = os.path.join(root, filename)
|
||||||
|
|
||||||
|
if not os.path.isdir(fullname):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if filename.startswith("paperless-tests-"):
|
||||||
|
shutil.rmtree(fullname, ignore_errors=True)
|
||||||
|
|
||||||
@override_settings(PAPERLESS_FILENAME_FORMAT="")
|
@override_settings(PAPERLESS_FILENAME_FORMAT="")
|
||||||
def test_source_filename(self):
|
def test_source_filename(self):
|
||||||
document = Document()
|
document = Document()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user