Skip to content

Commit

Permalink
Merge pull request #387 from ProjectQ-Framework/master
Browse files Browse the repository at this point in the history
ProjectQ v0.5.2
  • Loading branch information
Takishima committed Feb 16, 2021
2 parents c15f3b2 + 2354150 commit 44342ad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ before_script:
- "echo 'backend: Agg' > matplotlibrc"

# command to run tests
script: export OMP_NUM_THREADS=1 && pytest projectq --cov projectq
script: export OMP_NUM_THREADS=1 && pytest projectq --cov projectq -p no:warnings

after_success:
- coveralls
2 changes: 1 addition & 1 deletion projectq/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.

"""Define version number here and read it from setup.py automatically"""
__version__ = "0.5.1"
__version__ = "0.5.2"
30 changes: 16 additions & 14 deletions projectq/backends/_ibm/_ibm_http_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def raise_for_status(self):
# Accessing status of device. Return online.
status_url = 'Network/ibm-q/Groups/open/Projects/main/devices/v/1'
if (args[1] == urljoin(_API_URL, status_url)
and (request_num[0] == 1 or request_num[0] == 7)):
and (request_num[0] == 1 or request_num[0] == 6)):
request_num[0] += 1
connections = set([(0, 1), (1, 0), (1, 2), (1, 3), (1, 4), (2, 1),
(2, 3), (2, 4), (3, 1), (3, 4), (4, 3)])
Expand All @@ -97,15 +97,15 @@ def raise_for_status(self):
_API_URL,
"Network/ibm-q/Groups/open/Projects/main/Jobs/{execution_id}".
format(execution_id=execution_id)) and not result_ready[0]
and request_num[0] == 6):
and request_num[0] == 5):
result_ready[0] = True
request_num[0] += 1
return MockResponse({"status": "RUNNING"}, 200)
elif (args[1] == urljoin(
_API_URL,
"Network/ibm-q/Groups/open/Projects/main/Jobs/{execution_id}".
format(execution_id=execution_id)) and result_ready[0]
and request_num[0] == 8):
and request_num[0] == 7):
request_num[0] += 1
return MockResponse(
{"status": "COMPLETED"}, 200)
Expand All @@ -114,13 +114,13 @@ def raise_for_status(self):
_API_URL,
"Network/ibm-q/Groups/open/Projects/main/Jobs/{execution_id}/resultDownloadUrl".
format(execution_id=execution_id))
and request_num[0] == 9):
and request_num[0] == 8):
request_num[0] += 1
return MockResponse(
{"url": "result_download_url"}, 200)
#STEP7
elif (args[1] == "result_download_url"
and request_num[0] == 10):
and request_num[0] == 9):
request_num[0] += 1
return MockResponse(
{"results": [result]}, 200)
Expand Down Expand Up @@ -156,13 +156,14 @@ def raise_for_status(self):
answer1={'objectStorageInfo':{
'downloadQObjectUrlEndpoint':'url_dld_endpoint',
'uploadQobjectUrlEndpoint':'/'+execution_id+'/jobUploadUrl',
'uploadUrl':'url_upld'}
'uploadUrl':'url_upld'},
'id': execution_id
}
return MockPostResponse(answer1,200)

# STEP4
elif (args[1] == "/"+execution_id+"/jobDataUploaded"
and request_num[0] == 5):
elif (args[1] == urljoin(_API_URL, jobs_url + "/"+execution_id+"/jobDataUploaded")
and request_num[0] == 4):
request_num[0] += 1
return MockPostResponse({}, 200)

Expand All @@ -171,7 +172,7 @@ def raise_for_status(self):
_API_URL,
"Network/ibm-q/Groups/open/Projects/main/Jobs/{execution_id}/resultDownloaded".
format(execution_id=execution_id))
and request_num[0] == 11):
and request_num[0] == 10):
request_num[0] += 1
return MockPostResponse(
{}, 200)
Expand All @@ -195,8 +196,8 @@ def raise_for_status(self):
pass

# STEP3
if (args[1] == "s3_url"
and request_num[0] == 4):
if (args[1] == "url_upld"
and request_num[0] == 3):
request_num[0] += 1
return MockResponse({}, 200)

Expand Down Expand Up @@ -579,12 +580,13 @@ def raise_for_status(self):
answer1={'objectStorageInfo':{
'downloadQObjectUrlEndpoint':'url_dld_endpoint',
'uploadQobjectUrlEndpoint':'/'+execution_id+'/jobUploadUrl',
'uploadUrl':'url_upld'}
'uploadUrl':'url_upld'},
'id': execution_id,
}
return MockPostResponse(answer1,200)

# STEP4
elif (args[1] == "/"+execution_id+"/jobDataUploaded"):
elif (args[1] == urljoin(_API_URL, jobs_url + "/"+execution_id+"/jobDataUploaded")):
return MockPostResponse({}, 200)

def mocked_requests_put(*args, **kwargs):
Expand All @@ -606,7 +608,7 @@ def raise_for_status(self):
pass

# STEP3
if (args[1] == "s3_url"):
if (args[1] == "url_upld"):
return MockResponse({}, 200)

monkeypatch.setattr("requests.sessions.Session.get", mocked_requests_get)
Expand Down

0 comments on commit 44342ad

Please sign in to comment.