saghul / pycares

Python interface for c-ares
https://pypi.org/project/pycares/
MIT License
165 stars 73 forks source link

test fails with AssertionError: '' is not an instance of <class 'bytes'> #131

Closed asellappen closed 3 years ago

asellappen commented 3 years ago

having problem while porting power cpu arch for CI on the package as below in test it thorows error in bot harch amd64 & ppc64le.

as below

FAIL: test_result_not_ascii (main.DNSTest)

Traceback (most recent call last): File "./tests/tests.py", line 449, in test_result_not_ascii self.assertIsInstance(self.result.hostmaster, bytes) # it's not ASCII AssertionError: '' is not an instance of <class 'bytes'>

the issue is casued at the below script at ./tests/tests.py ,Please check

def test_result_not_ascii(self): self.result, self.errorno = None, None def cb(result, errorno): self.result, self.errorno = result, errorno self.channel.query('ayesas.com', pycares.QUERY_TYPE_SOA, cb) self.wait() self.assertNoError(self.errorno) self.assertEqual(type(self.result), pycares.ares_query_soa_result) self.assertIsInstance(self.result.hostmaster, bytes) # it's not ASCII self.assertTrue(self.result.ttl >= 0)

asellappen commented 3 years ago

Pls refer for details https://travis-ci.com/github/asellappen/pycares/jobs/428497326

simon28li commented 3 years ago

@asellappen I've been in the same situation. Traceback (most recent call last): File "tests.py", line 208, in test_query_txt_multiple_chunked self.assertEqual(len(self.result), 2) AssertionError: 3 != 2

====================================================================== FAIL: test_result_not_ascii (main.DNSTest)

Traceback (most recent call last): File "tests.py", line 406, in test_result_not_ascii self.assertIsInstance(r.host, bytes) # it's not ASCII AssertionError: 'mx01.ionos.es' is not an instance of <class 'bytes'>

====================================================================== FAIL: test_result_not_ascii2 (main.DNSTest)

Traceback (most recent call last): File "tests.py", line 417, in test_result_not_ascii2 self.assertIsInstance(self.result.hostmaster, bytes) # it's not ASCII AssertionError: '' is not an instance of <class 'bytes'>


Ran 42 tests in 31.395s

FAILED (failures=6, errors=1, skipped=1)

[root@localhost tests]# uname -a Linux localhost.localdomain 4.18.0-193.el8.aarch64 #1 SMP Fri May 8 11:05:12 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

[root@localhost tests]# cat /etc/os-release NAME="CentOS Linux" VERSION="8 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8 (Core)" ANSI_COLOR="0;31"

saghul commented 3 years ago

We've fixed the test since it became bogus, as the nameserver no longer gave that kind of response.