pudb
pudb copied to clipboard
Failing test TestFileSourceCodeProvider.test_get_lines on openSUSE
Packaging pudb for openSUSE and when running tests I get this:
[ 4s] + py.test-2.7
[ 4s] ============================= test session starts ==============================
[ 4s] platform linux2 -- Python 2.7.15, pytest-3.6.2, py-1.5.3, pluggy-0.6.0
[ 4s] rootdir: /home/abuild/rpmbuild/BUILD/pudb-2017.1.4, inifile:
[ 4s] plugins: mock-1.10.0
[ 5s] collected 14 items
[ 5s]
[ 5s] test/test_lowlevel.py ... [ 21%]
[ 5s] test/test_make_canvas.py ..... [ 57%]
[ 5s] test/test_settings.py .. [ 71%]
[ 5s] test/test_source_code_providers.py ..F. [100%]
[ 5s]
[ 5s] =================================== FAILURES ===================================
[ 5s] __________________ TestFileSourceCodeProvider.test_get_lines ___________________
[ 5s]
[ 5s] self = <test_source_code_providers.TestFileSourceCodeProvider instance at 0x7f035ea6ba28>
[ 5s] mocker = <pytest_mock.MockFixture object at 0x7f035eccb6d0>
[ 5s]
[ 5s] def test_get_lines(self, mocker):
[ 5s] provider = FileSourceCodeProvider(mocker.Mock(), 'test file name')
[ 5s] result = provider.get_lines(mocker.MagicMock())
[ 5s] > assert len(result) == 1
[ 5s] E assert 0 == 1
[ 5s] E + where 0 = len([])
[ 5s]
[ 5s] test/test_source_code_providers.py:28: AssertionError
[ 5s] ===================== 1 failed, 13 passed in 0.22 seconds ======================
[ 5s] error: Bad exit status from /var/tmp/rpm-tmp.ud877l (%check)
[ 5s]
The same for pudb-2018.1
.
Here's the FileSourceCodeProvider
constructor. It doesn't appear to accept a random string ('test file name'), but rather a filename. And it seems unlikely that mocker.Mock()
returns something that should be assigned to debugger
. But calling canonic
on it doesn't throw an error, so maybe it's OK:
class FileSourceCodeProvider(SourceCodeProvider):
def __init__(self, debugger, file_name):
self.file_name = debugger.canonic(file_name)
Works fine for me on 2.7:
https://gitlab.tiker.net/inducer/pudb/-/jobs/60922
I wonder what the difference is between your and my environment.