2018-06-08 21:00:58 +08:00
|
|
|
# Copyright 2017, IBM.
|
2017-05-12 00:12:57 +08:00
|
|
|
#
|
2018-06-08 21:00:58 +08:00
|
|
|
# This source code is licensed under the Apache License, Version 2.0 found in
|
|
|
|
# the LICENSE.txt file in the root directory of this source tree.
|
|
|
|
|
2019-02-06 05:28:16 +08:00
|
|
|
.PHONY: env lint test doc test_record test_mock test_ci
|
2017-05-08 21:25:14 +08:00
|
|
|
|
2017-06-20 23:17:11 +08:00
|
|
|
# Dependencies need to be installed on the Anaconda virtual environment.
|
2017-05-08 21:25:14 +08:00
|
|
|
env:
|
2019-01-21 20:03:51 +08:00
|
|
|
if test $(findstring qiskitenv, $(shell conda info --envs | tr '[:upper:]' '[:lower:]')); then \
|
|
|
|
bash -c "source activate Qiskitenv;pip install -r requirements.txt"; \
|
2017-08-08 04:44:17 +08:00
|
|
|
else \
|
2019-01-21 20:03:51 +08:00
|
|
|
conda create -y -n Qiskitenv python=3; \
|
|
|
|
bash -c "source activate Qiskitenv;pip install -r requirements.txt"; \
|
2017-08-08 04:44:17 +08:00
|
|
|
fi;
|
2017-06-20 23:17:11 +08:00
|
|
|
|
2017-05-11 18:59:08 +08:00
|
|
|
# Ignoring generated ones with .py extension.
|
2017-05-08 21:25:14 +08:00
|
|
|
lint:
|
2017-12-29 07:41:24 +08:00
|
|
|
pylint -rn qiskit test
|
|
|
|
|
|
|
|
style:
|
2018-02-05 18:47:53 +08:00
|
|
|
pycodestyle --max-line-length=100 qiskit test
|
2017-05-08 21:25:14 +08:00
|
|
|
|
2018-01-05 03:21:21 +08:00
|
|
|
# Use the -s (starting directory) flag for "unittest discover" is necessary,
|
|
|
|
# otherwise the QuantumCircuit header will be modified during the discovery.
|
2017-05-09 04:17:43 +08:00
|
|
|
test:
|
2019-02-06 05:28:16 +08:00
|
|
|
python3 -m unittest discover -s test -v
|
2017-07-05 21:05:19 +08:00
|
|
|
|
2018-08-21 02:42:23 +08:00
|
|
|
test_mock:
|
2019-02-06 05:28:16 +08:00
|
|
|
env QISKIT_TESTS=mock_online python3 -m unittest discover -s test -v
|
2018-08-21 02:42:23 +08:00
|
|
|
|
|
|
|
test_recording:
|
|
|
|
-rm test/cassettes/*
|
2019-02-06 05:28:16 +08:00
|
|
|
env QISKIT_TESTS=rec python3 -m unittest discover -s test -v
|
|
|
|
|
|
|
|
test_ci:
|
|
|
|
stestr run --concurrency 2
|
2018-08-21 02:42:23 +08:00
|
|
|
|
2017-07-05 21:05:19 +08:00
|
|
|
profile:
|
2019-02-06 05:28:16 +08:00
|
|
|
python3 -m unittest discover -p "profile*.py" -v
|
2017-07-27 00:32:54 +08:00
|
|
|
|
2018-03-06 03:38:13 +08:00
|
|
|
coverage:
|
2019-02-06 05:28:16 +08:00
|
|
|
coverage3 run --source qiskit -m unittest discover -s test -q
|
2018-03-06 03:38:13 +08:00
|
|
|
coverage3 report
|
|
|
|
|
2017-07-27 00:32:54 +08:00
|
|
|
doc:
|
2017-09-13 00:10:38 +08:00
|
|
|
export PYTHONPATH=$(PWD); \
|
2018-06-29 06:22:36 +08:00
|
|
|
for LANGUAGE in "." "de" "ja"; do \
|
2018-12-19 04:36:33 +08:00
|
|
|
better-apidoc -f -o doc/$$LANGUAGE/_autodoc --no-toc --private --maxdepth=5 --separate --templates=doc/_templates/better-apidoc qiskit "qiskit/extensions/standard/[a-z]*"; \
|
2017-11-09 01:13:43 +08:00
|
|
|
sphinx-autogen -t doc/_templates doc/$$LANGUAGE/_autodoc/*; \
|
|
|
|
make -C doc -e BUILDDIR="_build/$$LANGUAGE" -e SOURCEDIR="./$$LANGUAGE" html; \
|
|
|
|
done
|
2017-07-27 00:32:54 +08:00
|
|
|
|
2018-03-06 03:38:13 +08:00
|
|
|
coverage_erase:
|
|
|
|
coverage erase
|
|
|
|
|
|
|
|
clean: coverage_erase
|
2017-07-27 00:32:54 +08:00
|
|
|
make -C doc clean
|
2018-06-29 06:22:36 +08:00
|
|
|
make -C doc -e BUILDDIR="_build/de" -e SOURCEDIR="./de" clean
|
2017-11-09 01:13:43 +08:00
|
|
|
make -C doc -e BUILDDIR="_build/ja" -e SOURCEDIR="./ja" clean
|
2018-01-17 03:44:47 +08:00
|
|
|
rm -f test/python/test_latex_drawer.tex test/python/test_qasm_python_simulator.pdf \
|
|
|
|
test/python/test_save.json test/python/test_teleport.tex
|