Relates to https://pagure.io/waiverdb/issue/365
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr
With this PR, the tests are passing for me locally. However, there are a lot of noise at the end of the run (see below) which make me doubt if this is the right approach/fix.
@cverna you added the patch on _session_cache, do you remember by any chances why or what it was meant to do?
_session_cache
--- Logging error --- Traceback (most recent call last): File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit stream.write(msg) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/_pytest/capture.py", line 427, in write self.buffer.write(obj) ValueError: I/O operation on closed file Call stack: File "/usr/lib64/python3.6/threading.py", line 884, in _bootstrap self._bootstrap_inner() File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib64/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/crochet/_eventloop.py", line 412, in <lambda> target=lambda: self._reactor.run(installSignalHandlers=False), File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/base.py", line 1283, in run self.mainLoop() File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/base.py", line 1295, in mainLoop self.doIteration(t) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/epollreactor.py", line 235, in doPoll log.callWithLogger(selectable, _drdw, selectable, fd, event) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext return func(*args,**kw) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 627, in _doReadOrWrite self._disconnectSelectable(selectable, why, inRead) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 255, in _disconnectSelectable selectable.connectionLost(f) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/tcp.py", line 520, in connectionLost self.connector.connectionLost(reason) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/base.py", line 1174, in connectionLost self.factory.doStop() File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/protocol.py", line 96, in doStop self.stopFactory() File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator return _cancellableInlineCallbacks(gen) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks _inlineCallbacks(None, g, status) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/fedora_messaging/twisted/factory.py", line 379, in stopFactory yield self._client.halt() File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator return _cancellableInlineCallbacks(gen) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks _inlineCallbacks(None, g, status) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "/home/pierrey/repos/gitrepo/waiverdb/.tox/py36/lib/python3.6/site-packages/fedora_messaging/twisted/protocol.py", line 594, in halt _std_log.info("Disconnect requested, but AMQP connection already gone") Message: 'Disconnect requested, but AMQP connection already gone' Arguments: () --- Logging error ---
Build 7ac5992d89cb9985707eacff7f182ea98661b6f7 FAILED! Rebase or make new commits to rebuild.
1 new commit added
Add missing requirement to the requirements.txt file
Add the test requirements when building the doc
Build 3c1265d11dd3dce11393df03ad3bf1c29583caf9 FAILED! Rebase or make new commits to rebuild.
flake8 complains that from mock import patch is not needed.
flake8
from mock import patch
With this PR, the tests are passing for me locally. However, there are a lot of noise at the end of the run (see below) which make me doubt if this is the right approach/fix. @cverna you added the patch on _session_cache, do you remember by any chances why or what it was meant to do?
Sorry but I honestly have no idea :(
rebased onto e0987a9d04907efd923d26a969a53eb6b7fa5e98
Build 56d81cab9752e359e64f09b099a10f4a6fb1ff33 FAILED! Rebase or make new commits to rebuild.
you added the patch on _session_cache, do you remember by any chances why or what it was meant to do?
It looks like it was used to avoid sending messages when running tests. Better way would be to set MESSAGE_BUS_PUBLISH = False in TestingConfig and enable/mock it when needed.
MESSAGE_BUS_PUBLISH = False
TestingConfig
Not sure why it works for you locally - I would expect some tests to fail (as it happens on Jenkins).
But if I revert the removed patch line, I see failed test case:
patch
=================================== FAILURES =================================== _______________________ test_404_for_nonexistent_waiver ________________________ client = <FlaskClient <Flask 'waiverdb.app'>> session = <sqlalchemy.orm.scoping.scoped_session object at 0x7fa845ecf358> def test_404_for_nonexistent_waiver(client, session): r = client.get('/api/v1.0/waivers/foo') assert r.status_code == 404 res_data = json.loads(r.get_data(as_text=True)) message = ( 'The requested URL was not found on the server. If you entered the ' 'URL manually please check your spelling and try again.') > assert res_data['message'] == message E AssertionError: assert ('The requested URL was not found on the server. If you entered the URL '\n 'manually please check your spelling and try again.') == ('The requested URL was not found on the server. If you entered the URL '\n 'manually please check your spelling and try again.') E - The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. E ? - E + The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
BTW, I'm running tests with podman-compose from greenwave repo clone (make up && make test-waiverdb).
make up && make test-waiverdb
@pingou Is this patch still needed?
Pull-Request has been closed by lholecek
I honestly don't know any more :(
Relates to https://pagure.io/waiverdb/issue/365
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr