mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-24 19:17:48 +01:00
8c88de9d93
This warning is raised when a file is opened inside a test, but not closed. This can help spot bugs in Wagtail. ResourceWarning was added in Python 3.2 and isn't available in Python 2
34 lines
851 B
Python
Executable File
34 lines
851 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
import os
|
|
import shutil
|
|
import warnings
|
|
|
|
from django.core.management import execute_from_command_line
|
|
|
|
from wagtail.tests.settings import STATIC_ROOT, MEDIA_ROOT
|
|
|
|
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtail.tests.settings'
|
|
|
|
|
|
def runtests():
|
|
# Don't ignore DeprecationWarnings
|
|
warnings.simplefilter('default', DeprecationWarning)
|
|
warnings.simplefilter('default', PendingDeprecationWarning)
|
|
|
|
# Don't ignore ResourceWarnings (Python 3 only)
|
|
if sys.version_info >= (3, 0):
|
|
warnings.simplefilter('default', ResourceWarning)
|
|
|
|
argv = sys.argv[:1] + ['test'] + sys.argv[1:]
|
|
try:
|
|
execute_from_command_line(argv)
|
|
finally:
|
|
shutil.rmtree(STATIC_ROOT, ignore_errors=True)
|
|
shutil.rmtree(MEDIA_ROOT, ignore_errors=True)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
runtests()
|