这是一个django项目,我们用它来让测试框架在本地运行单元和功能测试。然后,我们没有看到约2个月,有些事情发生了变化,我不知道到底是什么。
运行命令:
python manage.py test test_deploy.functional_tests --settings=app.settings.local
我收到错误:
Not Found: /static/assets/css/styles.400383614f0b.css
Not Found: /static/assets/js/mqtt-global.fb8230b7da31.js
Not Found: /static/assets/js/jquery-validate-min.7b9b8777185d.js
Not Found: /static/assets/js/registration/login.c8a1a15757a7.js
Not Found: /static/assets/css/styles.400383614f0b.css
Not Found: /static/assets/images/favicon-32.21410c731917.png
Not Found: /static/assets/images/favicon-192.86084ccb3d72.png
Not Found: /static/assets/images/xxx-logo.3e8cbbad4c76.svg
Not Found: /static/assets/js/xxxx-global.fb8230b7da31.js
Not Found: /static/assets/js/jquery-validate-min.7b9b8777185d.js
Not Found: /static/assets/js/registration/login.c8a1a15757a7.js
Not Found: /static/assets/css/styles.400383614f0b.css
对于功能测试,浏览器打开但没有加载任何资产,因为它无法找到它们:
本地设置文件:
from .base import *
import os
from os.path import join, abspath, dirname
DEBUG = True
DEBUG_TOOLBAR_PATCH_SETTINGS = False
TEST_APPS = (
'debug_toolbar',
)
INSTALLED_APPS += TEST_APPS
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ADMINS = (
('xxx', 'xxx@xxx.xx'),
)
MANAGERS = ADMINS
DEFAULT_HOST='xx'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'xx',
'USER': 'xx',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '5432',
}
}
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
TESTFILES_FOLDER = os.path.join(BASE_DIR, '../test_deploy/functional_tests')
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = BASE_DIR # change this to a proper location
STATIC_ROOT = "xx"
# You might want to use sqlite3 for testing in local as it's much faster.
DEFAULT_FROM_EMAIL = 'testing@example.com'
STATIC_ROOT = join(PROJECT_ROOT, 'static/')
STATICFILES_DIRS = ()