cubicweb #7485127 tests sometimes fail due to missing anonymous user [validation pending]

to reproduce :

$ python devtools/test/unittest_webtest.py CWTIdentTC
[...]
OK
$ python devtools/test/unittest_webtest.py CWTTC
[...]
======================================================================
ERROR: test_base_url (__main__.CWTTC)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "devtools/test/unittest_webtest.py", line 13, in test_base_url
    if self.config['base-url'] not in self.webapp.get('/').text:
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 321, in get
    expect_errors=expect_errors)
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 630, in do_request
    self._check_status(status, res)
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 662, in _check_status
    res)
AppError: Bad response: 403 FORBIDDEN (not 200 OK or 3xx redirect for http://localhost/)
[...]

======================================================================
ERROR: test_response (__main__.CWTTC)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "devtools/test/unittest_webtest.py", line 9, in test_response
    response = self.webapp.get('/')
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 321, in get
    expect_errors=expect_errors)
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 630, in do_request
    self._check_status(status, res)
  File "/usr/lib/python2.7/dist-packages/webtest/app.py", line 662, in _check_status
    res)
AppError: Bad response: 403 FORBIDDEN (not 200 OK or 3xx redirect for http://localhost/)
[...]

----------------------------------------------------------------------
Ran 2 tests in 0.829s

FAILED (errors=2)

The issue is that after running the first TestCase, we have the following databases:

$ find -name '*tmpdb*'
./devtools/test/data/database/tmpdb-webtest-ident.sqlite
./devtools/test/data/database/tmpdb-__default_empty_db__.config
./devtools/test/data/database/tmpdb-__default_empty_db__.sqlite
./devtools/test/data/database/tmpdb-webtest-ident.config

In other words, __default_empty_db__ is still created, but with a configuration that has anonymous_allowed set to False. All other tests in ./devtools/ will try to reuse this DB due to the cache system, and will fail miserably if they expected anonymous login to work.

prioritynormal
typebug
done in3.22.0
load1.000
load left0.000
closed by#eb05348b0e2d [devtools] Disable anonymous login right before executing tests
patch[devtools] Disable anonymous login right before executing tests [applied]