Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLBearDTDUrlTest.test_valid_files fails with openSUSE libxml2-tools-2.9.9-158.2 #2874

Open
jayvdb opened this issue Feb 13, 2019 · 1 comment

Comments

@jayvdb
Copy link
Member

jayvdb commented Feb 13, 2019

To reproduce, branch https://build.opensuse.org/package/show/home:jayvdb:coala/python-coala-bears , and edit the .spec to allow that test to run (I am deselecting it most of the time)

Error failed to load external entity "http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd" suggests that this is caused by the RPM build environment not having internet access.

[  452s] ______________________ XMLBearDTDUrlTest.test_valid_files ______________________
[  452s] 
[  452s] self = <coalib.testing.LocalBearTestHelper.verify_local_bear.<locals>.LocalBearTest testMethod=test_valid_files>
[  452s] 
[  452s]     def test_valid_files(self):
[  452s]         self.assertIsInstance(valid_files, (list, tuple))
[  452s]         for file in valid_files:
[  452s]             self.check_validity(self.uut,
[  452s]                                 file.splitlines(keepends=True),
[  452s]                                 filename,
[  452s]                                 valid=True,
[  452s]                                 force_linebreaks=force_linebreaks,
[  452s]                                 create_tempfile=create_tempfile,
[  452s] >                               tempfile_kwargs=tempfile_kwargs)
[  452s] 
[  452s] /usr/lib/python3.7/site-packages/coalib/testing/LocalBearTestHelper.py:401: 
[  452s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  452s] /usr/lib/python3.7/site-packages/coalib/testing/LocalBearTestHelper.py:174: in check_validity
[  452s]     aspects=aspects,
[  452s] /usr/lib/python3.7/site-packages/coalib/testing/LocalBearTestHelper.py:287: in check_results
[  452s]     self.assertComparableObjectsEqual(bear_output, results)
[  452s] /usr/lib/python3.7/site-packages/coalib/testing/LocalBearTestHelper.py:138: in assertComparableObjectsEqual
[  452s]     self.assertEqual(observed_result, expected_result)
[  452s] E   AssertionError: Lists differ: [<Result object(id=0xeced858f37924afd8870b[467 chars]198>] != []
[  452s] E   
[  452s] E   First list contains 1 additional elements.
[  452s] E   First extra element 0:
[  452s] E   <Result object(id=0xeced858f37924afd8870bda4645efe07, origin='XMLBear', affected_code=(<SourceRange object(start=<SourcePosition object(file='/tmp/tmp7c_nx8pv.xml', line=2, column=None) at 0x7fbdd2870320>, end=<SourcePosition object(file='/tmp/tmp7c_nx8pv.xml', line=2, column=None) at 0x7fbdd28705f8>) at 0x7fbdd2870400>,), severity=NORMAL, confidence=100, message='failed to load external entity "http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd"', aspect=NoneType, applied_actions={}) at 0x7fbdd2870198>
[  452s] E   
[  452s] E   - [<Result object(id=0xeced858f37924afd8870bda4645efe07, origin='XMLBear', affected_code=(<SourceRange object(start=<SourcePosition object(file='/tmp/tmp7c_nx8pv.xml', line=2, column=None) at 0x7fbdd2870320>, end=<SourcePosition object(file='/tmp/tmp7c_nx8pv.xml', line=2, column=None) at 0x7fbdd28705f8>) at 0x7fbdd2870400>,), severity=NORMAL, confidence=100, message='failed to load external entity "http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd"', aspect=NoneType, applied_actions={}) at 0x7fbdd2870198>]
[  452s] E   + []
@jayvdb
Copy link
Member Author

jayvdb commented Feb 13, 2019

$ git grep concept.dtd tests
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ STDIN
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ tests/xml2/XMLBearTest.py:dtd_url = 'http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd'
   2   │ tests/xml2/test_files/concept-invalid.xml:<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd">
   3   │ tests/xml2/test_files/concept-valid.xml:<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "http://docs.oasis-open.org/dita/v1.0.1/dtd/concept.dtd">

One approach is to use test data which is already included in distro packages, but that depends on whether the xml2 library can find local copies of external URL dtds.

Alternatively we need a mechanism for skipping tests which depend on online resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants