[swift-corelibs-dev] Failing test due to network XML validation
Alex Blewitt
alblue at apple.com
Thu Sep 29 04:38:19 CDT 2016
There's a test which attempts to download an XML DTD from an external file, which fails when there's an intermittent network connection:
Test Case 'TestNSArray.test_writeToFile' started at 09:15:53.214
I/O warning : failed to load external entity "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
.../swift-corelibs-foundation/TestFoundation/TestNSArray.swift:492: error: TestNSArray.test_writeToFile : failed - XMLDocument failes to read / validate contenets
It's probably not a good idea to have remote DTD parsing enabled, especially for testing a write to file method. Plus, there's a spelling error or two :)
This happens because the XML document has 'validate' called on it:
let plistDoc = try XMLDocument(contentsOf: URL(fileURLWithPath: testFilePath!, isDirectory: false), options: [])
try plistDoc.validate()
https://github.com/apple/swift-corelibs-foundation/blob/e05884bd835f6ee22e7c0b0484326d63c31d554a/TestFoundation/TestNSArray.swift#L485-L486 <https://github.com/apple/swift-corelibs-foundation/blob/e05884bd835f6ee22e7c0b0484326d63c31d554a/TestFoundation/TestNSArray.swift#L485-L486>
I don't think the validate call is adding anything here, because if it's invalid then the subsequent assert will fail, and we're just testing whether or not we can read the contents from file.
Should we remove the try/validate statement here?
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160929/87fd3a40/attachment.html>
More information about the swift-corelibs-dev
mailing list