4.1.2: pytest is failing
See original GitHub issueI’m trying to package your module as an rpm package. So I’m using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
- because I’m calling
build
with--no-isolation
I’m using during all processes oly locally installed modules - install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pycares-4.1.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pycares-4.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra tests/tests.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pycares-pycares-4.1.2
plugins: cov-3.0.0, hypothesis-6.35.0
collected 54 items
tests/tests.py ........FFFFF.....xx.........s....................Fs.. [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________________ DNSTest.test_getaddrinfo _________________________________________________________________________
self = <tests.DNSTest testMethod=test_getaddrinfo>
@unittest.skipIf(sys.platform == 'win32', 'skipped on Windows')
def test_getaddrinfo(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.getaddrinfo('localhost', 80, cb)
self.wait()
self.assertNoError(self.errorno)
> self.assertEqual(type(self.result), pycares.ares_addrinfo_result)
E AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
tests/tests.py:52: AssertionError
________________________________________________________________________ DNSTest.test_getaddrinfo2 _________________________________________________________________________
self = <tests.DNSTest testMethod=test_getaddrinfo2>
@unittest.skipIf(sys.platform == 'win32', 'skipped on Windows')
def test_getaddrinfo2(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.getaddrinfo('localhost', 'http', cb)
self.wait()
self.assertNoError(self.errorno)
> self.assertEqual(type(self.result), pycares.ares_addrinfo_result)
E AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
tests/tests.py:65: AssertionError
________________________________________________________________________ DNSTest.test_getaddrinfo3 _________________________________________________________________________
self = <tests.DNSTest testMethod=test_getaddrinfo3>
@unittest.skipIf(sys.platform == 'win32', 'skipped on Windows')
def test_getaddrinfo3(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.getaddrinfo('localhost', None, cb)
self.wait()
self.assertNoError(self.errorno)
> self.assertEqual(type(self.result), pycares.ares_addrinfo_result)
E AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
tests/tests.py:78: AssertionError
________________________________________________________________________ DNSTest.test_getaddrinfo4 _________________________________________________________________________
self = <tests.DNSTest testMethod=test_getaddrinfo4>
@unittest.skipIf(sys.platform == 'win32', 'skipped on Windows')
def test_getaddrinfo4(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.getaddrinfo('localhost', 'http', cb, family=socket.AF_INET)
self.wait()
self.assertNoError(self.errorno)
> self.assertEqual(type(self.result), pycares.ares_addrinfo_result)
E AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
tests/tests.py:91: AssertionError
________________________________________________________________________ DNSTest.test_getaddrinfo5 _________________________________________________________________________
self = <tests.DNSTest testMethod=test_getaddrinfo5>
def test_getaddrinfo5(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.getaddrinfo('google.com', 'http', cb)
self.wait()
self.assertNoError(self.errorno)
> self.assertEqual(type(self.result), pycares.ares_addrinfo_result)
E AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
tests/tests.py:104: AssertionError
______________________________________________________ DNSTest.test_query_txt_multiple_chunked_with_non_ascii_content ______________________________________________________
self = <tests.DNSTest testMethod=test_query_txt_multiple_chunked_with_non_ascii_content>
def test_query_txt_multiple_chunked_with_non_ascii_content(self):
self.result, self.errorno = None, None
def cb(result, errorno):
self.result, self.errorno = result, errorno
self.channel.query('txt-non-ascii.dns-test.hmnid.ru', pycares.QUERY_TYPE_TXT, cb)
self.wait()
> self.assertNoError(self.errorno)
tests/tests.py:342:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/tests.py:42: in assertNoError
self.assertEqual(errorno, None)
E AssertionError: 11 != None
============================================================================= warnings summary =============================================================================
tests/tests.py::DNSTest::test_getaddrinfo
tests/tests.py::DNSTest::test_getaddrinfo2
tests/tests.py::DNSTest::test_getaddrinfo3
tests/tests.py::DNSTest::test_getaddrinfo4
tests/tests.py::DNSTest::test_getaddrinfo5
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored from cffi callback <function _addrinfo_cb at 0x7fee640f7b80>: None
Traceback (most recent call last):
File "/home/tkloczko/rpmbuild/BUILDROOT/python-pycares-4.1.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/pycares/__init__.py", line 162, in _addrinfo_cb
result = ares_addrinfo_result(res)
File "/home/tkloczko/rpmbuild/BUILDROOT/python-pycares-4.1.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/pycares/__init__.py", line 841, in __init__
cname_ptr = ares_addrinfo.cnames
ffi.error: struct ares_addrinfo: wrong total size (cdef says 16, but C compiler says 24). fix it or use "...;" as the last field in the cdef for struct ares_addrinfo to make it flexible
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/tests.py:421: ANY type does not work on Mac.
SKIPPED [1] tests/tests.py:528: The site used for this test no longer returns a non-ascii SOA.
XFAIL tests/tests.py::DNSTest::test_getnameinfo_ipv6
reason:
XFAIL tests/tests.py::DNSTest::test_getnameinfo_ipv6_ll
reason:
FAILED tests/tests.py::DNSTest::test_getaddrinfo - AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
FAILED tests/tests.py::DNSTest::test_getaddrinfo2 - AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
FAILED tests/tests.py::DNSTest::test_getaddrinfo3 - AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
FAILED tests/tests.py::DNSTest::test_getaddrinfo4 - AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
FAILED tests/tests.py::DNSTest::test_getaddrinfo5 - AssertionError: <class 'NoneType'> != <class 'pycares.ares_addrinfo_result'>
FAILED tests/tests.py::DNSTest::test_query_txt_multiple_chunked_with_non_ascii_content - AssertionError: 11 != None
===================================================== 6 failed, 44 passed, 2 skipped, 2 xfailed, 5 warnings in 21.68s ======================================================
BTW: without passing to pytest tests/tests.py
it is not able to find units. Probably it would be good to add some testing description in pytest.ini.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Changelog — pytest documentation
After 6.2.0, these types began failing, because they inherited neither from standard Python number hierarchy nor from numpy.ndarray .
Read more >Test works normally but fails under pytest with assertion ...
Given a test file p.py containing: def test_add(): add = lambda *t: sum(t) l = range(8) e = iter(l) assert sum(l[:4]) == add(*[next(e)...
Read more >pytest Documentation - Read the Docs
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you under-.
Read more >pytest-rerunfailures - PyPI
pytest plugin to re-run tests to eliminate flaky failures. ... pytest --reruns 5. Failed fixture or setup_class will also be re-executed.
Read more >Pytest-BDD 4.1.0 documentation - Read the Docs
pytest-bdd implements a subset of the Gherkin language to enable automating project ... feature, scenario, step, exception) - Called when step lookup failed ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing. Looks like latest 4.2.1 version no longer fails
Just FTR. New 4.2.0 still fails but in one unit less. Here is pytest output:
There are some warnings which could be used to improve test suite.