Skip to content

Commit

Permalink
Qiskit v0.20 (#101)
Browse files Browse the repository at this point in the history
* Removing the now supported CU1 gate and adjusting the number of entries in the record

* Pinning to Qiskit >=0.20

* Monkeypatch IBMQX_TOKEN
  • Loading branch information
antalszava authored Aug 12, 2020
1 parent 396094a commit ca61424
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit>=0.19.1
qiskit>=0.20
pennylane>=0.9.0
numpy
networkx>=2.2;python_version>'3.5'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
long_description = fh.read()

requirements = [
"qiskit>=0.19.1",
"qiskit>=0.20",
"pennylane>=0.9.0",
"numpy",
"networkx>=2.2;python_version>'3.5'",
Expand Down
11 changes: 1 addition & 10 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,8 @@ class TestConverterQasm:
'x q[2];' \
'barrier q;' \
'h q[0];' \
'cu1(pi/2) q[1],q[0];' \
'h q[1];' \
'cu1(pi/4) q[2],q[0];' \
'cu1(pi/2) q[2],q[1];' \
'h q[2];' \
'cu1(pi/8) q[3],q[0];' \
'cu1(pi/4) q[3],q[1];' \
'cu1(pi/2) q[3],q[2];' \
'h q[3];' \
'measure q -> c;'

Expand Down Expand Up @@ -812,16 +806,13 @@ def test_qasm_from_file(self, tmpdir, recorder):
assert recorder.queue[5].parameters == []
assert recorder.queue[5].wires == Wires([3])

assert len(record) == 11
assert len(record) == 5
# check that the message matches
assert record[0].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('Barrier')
assert record[1].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('CU1Gate')
assert record[7].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('Measure')

def test_qasm_file_not_found_error(self):
Expand Down
6 changes: 4 additions & 2 deletions tests/test_ibmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ def test_load_from_disk(token):
IBMQ.delete_account()


def test_account_error():
def test_account_error(monkeypatch):

# Token is passed such that the test is skipped if no token was provided
with pytest.raises(IBMQAccountError, match="No active IBM Q account"):
IBMQDevice(wires=1)
with monkeypatch.context() as m:
m.delenv("IBMQX_TOKEN", raising=False)
IBMQDevice(wires=1)


@pytest.mark.parametrize("analytic", [False])
Expand Down

0 comments on commit ca61424

Please sign in to comment.