Yelp / swagger_spec_validator

Other
104 stars 71 forks source link

Test suite can fail on some hosts #25

Open dnephin opened 9 years ago

dnephin commented 9 years ago

I ran the test suite on my desktop, and ran into 3 test failures:

tests/util/validate_spec_url_test.py:10: test_raise_SwaggerValidationError_on_urlopen_error
tests/validator12/validate_spec_url_test.py:50: test_raise_SwaggerValidationError_on_urlopen_error
tests/validator20/validate_spec_url_test.py:20: test_raise_SwaggerValidationError_on_urlopen_error

They all fail with:

assert '<urlopen error [Errno -2] Name or service not known>' in '<urlopen error [Errno -5] No address associated with hostname>'

It seems like the test suite assumes a specific error about the bogus url that is not always true. These assertions should probably be a little more generic.

prat0318 commented 9 years ago

If there are more possible error reasons for bogus urls, a possible fix can be to check for 'urlopen error' instead of the complete reason.