handling of RuntimeWarnings and warnings in general in the Bliss shell
(reported by @holger.witsch)
when trying open a session in bliss that contains a non-existing object in its yaml entry config-objects:
there is a non-comprehensible error message: AttributeError: 'NoneType' object has no attribute 'get'
In library mode there some more information:
RuntimeWarning: Session no_real_session: object no_real_obj does not exist, ignoring RuntimeWarning
...
AttributeError: 'NoneType' object has no attribute 'get'
This lets me wonder if we have a problem with displaying warnings in bliss in general. ... I would have expected to see RuntimeWarnings
at least...
To make things more confusing I tried a add a test showing the problem but this passes without problem without... Something that I don't like at all as well...
pithan@lpithan:~/dev/bliss_jul25$ pytest tests/session/test_session.py::test_faulty_session_config -s
================================================================================= test session starts =================================================================================
platform linux -- Python 3.7.4, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- /users/pithan/miniconda3/envs/bliss_jul25/bin/python
cachedir: .pytest_cache
rootdir: /users/pithan/dev/bliss_jul25, inifile: setup.cfg
plugins: rerunfailures-7.0, repeat-0.8.0, mock-1.10.4, cov-2.7.1
collected 1 item
tests/session/test_session.py::test_faulty_session_config * Serving Flask app "bliss.config.conductor.web.config_app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Traceback (most recent call last):
File "/users/pithan/dev/bliss_jul25/bliss/common/session.py", line 395, in setup
self._load_config(verbose)
File "/users/pithan/dev/bliss_jul25/bliss/common/session.py", line 459, in _load_config
for item_name in self.object_names:
File "/users/pithan/dev/bliss_jul25/bliss/common/session.py", line 277, in object_names
class_name = object_config.get("class", "")
AttributeError: 'NoneType' object has no attribute 'get'
SETUP FAULTY SESSION
PASSED: 45989
INFO 2019-10-14 08:59:07,259 beacon.redis: 7700:M 14 Oct 2019 08:59:07.258 * DB saved on disk
INFO 2019-10-14 08:59:07,589 beacon: Received an interruption signal!
INFO 2019-10-14 08:59:07,589 beacon: Cleaning up the subprocesses
================================================================================== warnings summary ===================================================================================
tests/session/test_session.py::test_faulty_session_config
/users/pithan/dev/bliss_jul25/bliss/common/session.py:273: RuntimeWarning: Session no_real_session: object no_real_obj does not exist, ignoring
RuntimeWarning,
-- Docs: https://docs.pytest.org/en/latest/warnings.html
======================================================================== 1 passed, 1 warnings in 3.78 seconds =========================================================================
the test that I tried was dead simple:
def test_faulty_session_config(beacon):
conf = static.get_config()
s = conf.get("no_real_session")
s.setup()