Added svn symlink check and creation to test setup. Forced test settings to use an empty INTERNAL_IPS list for consistency in code coverage figures.

- Legacy-Id: 12929
This commit is contained in:
Henrik Levkowetz 2017-02-28 18:02:30 +00:00
parent 171a7be029
commit 5928bd9faa
2 changed files with 19 additions and 8 deletions

View file

@ -261,15 +261,9 @@ def check_cache(app_configs, **kwargs):
errors.append(cache_error("Cache didn't accept session cookie age", "E0016"))
return errors
@checks.register('cache')
def check_svn_import(app_configs, **kwargs):
#
if already_ran():
return []
#
errors = []
#
def maybe_create_svn_symlinks(settings):
site_packages_dir = None
errors = []
for p in sys.path:
if ('/env/' in p or '/venv/' in p) and '/site-packages' in p:
site_packages_dir = p
@ -289,6 +283,17 @@ def check_svn_import(app_configs, **kwargs):
hint = "Please provide the correct python system site-package paths for\n"
"svn and libsvn in SVN_PACKAGES.",
id = "datatracker.E0015",))
return errors
@checks.register('cache')
def check_svn_import(app_configs, **kwargs):
#
if already_ran():
return []
#
errors = []
#
errors += maybe_create_svn_symlinks(settings)
#
if settings.SERVER_MODE == 'production':
try:

View file

@ -65,6 +65,7 @@ import ietf
import ietf.utils.mail
from ietf.utils.test_smtpserver import SMTPTestServerDriver
from ietf.utils.test_utils import TestCase
from ietf.checks import maybe_create_svn_symlinks
loaded_templates = set()
visited_urls = set()
@ -423,6 +424,10 @@ class IetfTestRunner(DiscoverRunner):
print(" Changing TEMPLATES[0]['OPTIONS']['string_if_invalid'] to '' during testing")
settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] = ''
if settings.INTERNAL_IPS:
print " Changing INTERNAL_IPS to '[]' during testing."
settings.INTERNAL_IPS = []
assert not settings.IDTRACKER_BASE_URL.endswith('/')
# Try to set up an SMTP test server. In case other test runs are
@ -439,6 +444,7 @@ class IetfTestRunner(DiscoverRunner):
except socket.error:
pass
maybe_create_svn_symlinks(settings)
super(IetfTestRunner, self).setup_test_environment(**kwargs)