test_work_simple and test_work_simple_xml will retry fetching added_works, if the add_record succeeded with HTTP 200, but no added_works is returned on the first attempt.
Motivation
One particular fail case, which caused all of the other failures, was an assertion failure after addition of a new record. The latter failures were conflicts (HTTP 409) due to test leakage, as clean-up code was not executed after the first failure, and tests were trying to add an already existing record to ORCID.
In the former case, despite the fact that the record addition request itself seemed to proceed with no errors, the API returned zero results when queried for the added record. This could be caused by some delays in refreshing, maybe the requests were being sent too quickly. This is made more probable by the fact that when ran on my personal branch, the tests were flaky, and when I retried them they passed (even though no changes to the code logic had been done at that point).
This aims to fix failing Travis tests after #21.
Changes
test_work_simple
andtest_work_simple_xml
will retry fetchingadded_works
, if theadd_record
succeeded with HTTP 200, but noadded_works
is returned on the first attempt.Motivation
One particular fail case, which caused all of the other failures, was an assertion failure after addition of a new record. The latter failures were conflicts (HTTP 409) due to test leakage, as clean-up code was not executed after the first failure, and tests were trying to add an already existing record to ORCID.
In the former case, despite the fact that the record addition request itself seemed to proceed with no errors, the API returned zero results when queried for the added record. This could be caused by some delays in refreshing, maybe the requests were being sent too quickly. This is made more probable by the fact that when ran on my personal branch, the tests were flaky, and when I retried them they passed (even though no changes to the code logic had been done at that point).
Adding three retries with delays before failing that test case may solve this issue, and it seems to have worked on my personal branch: https://travis-ci.org/szymonlopaciuk/python-orcid/builds/295723393.