From 4c7fa85085c29de87d6be4a9b14555528286be80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 27 Jan 2021 14:59:18 -0800 Subject: [PATCH 1/4] only test notebooks that are checked into git --- dev_tools/notebook_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dev_tools/notebook_test.py b/dev_tools/notebook_test.py index 1990f65cd9d..c8fe065791d 100644 --- a/dev_tools/notebook_test.py +++ b/dev_tools/notebook_test.py @@ -15,6 +15,7 @@ import glob import os import sys +from typing import Set import pytest from filelock import FileLock @@ -35,8 +36,13 @@ ] +def _list_all_notebooks() -> Set[str]: + """Get the root of the git repository the cwd is within.""" + return set(shell_tools.output_of('git', 'ls-files', '*.ipynb').splitlines()) + + def _tested_notebooks(): - all_notebooks = set(glob.glob("**/*.ipynb", recursive=True)) + all_notebooks = _list_all_notebooks() skipped_notebooks = functools.reduce( lambda a, b: a.union(b), list(set(glob.glob(g, recursive=True)) for g in SKIP_NOTEBOOKS) ) From 02cb9e66ac2385e36546522ac7fe4d47752ff897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 27 Jan 2021 15:01:05 -0800 Subject: [PATCH 2/4] remove copy paste comment --- dev_tools/notebook_test.py | 1 - examples/advanced/quantum_volume_errors.ipynb | 2 +- examples/advanced/quantum_volume_routing.ipynb | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dev_tools/notebook_test.py b/dev_tools/notebook_test.py index c8fe065791d..4df7c29e1b0 100644 --- a/dev_tools/notebook_test.py +++ b/dev_tools/notebook_test.py @@ -37,7 +37,6 @@ def _list_all_notebooks() -> Set[str]: - """Get the root of the git repository the cwd is within.""" return set(shell_tools.output_of('git', 'ls-files', '*.ipynb').splitlines()) diff --git a/examples/advanced/quantum_volume_errors.ipynb b/examples/advanced/quantum_volume_errors.ipynb index 5067bb3cfd8..b5f056e77f0 100644 --- a/examples/advanced/quantum_volume_errors.ipynb +++ b/examples/advanced/quantum_volume_errors.ipynb @@ -127,4 +127,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file diff --git a/examples/advanced/quantum_volume_routing.ipynb b/examples/advanced/quantum_volume_routing.ipynb index 7c07e8ef05d..5a7ed328362 100644 --- a/examples/advanced/quantum_volume_routing.ipynb +++ b/examples/advanced/quantum_volume_routing.ipynb @@ -126,4 +126,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file From 709d382047618a75faf99d8d198c5760041fca14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 27 Jan 2021 17:46:49 -0800 Subject: [PATCH 3/4] fix test collection --- dev_tools/notebook_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev_tools/notebook_test.py b/dev_tools/notebook_test.py index 4df7c29e1b0..76102092f5e 100644 --- a/dev_tools/notebook_test.py +++ b/dev_tools/notebook_test.py @@ -14,6 +14,7 @@ import functools import glob import os +import subprocess import sys from typing import Set @@ -37,7 +38,8 @@ def _list_all_notebooks() -> Set[str]: - return set(shell_tools.output_of('git', 'ls-files', '*.ipynb').splitlines()) + output = subprocess.check_output(['git', 'ls-files', '*.ipynb']) + return set(output.decode('utf-8').splitlines()) def _tested_notebooks(): From ee0129dbd89e0701b790c27ee8f7a86521427705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 27 Jan 2021 17:47:29 -0800 Subject: [PATCH 4/4] revert accidental modification --- examples/advanced/quantum_volume_errors.ipynb | 2 +- examples/advanced/quantum_volume_routing.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/advanced/quantum_volume_errors.ipynb b/examples/advanced/quantum_volume_errors.ipynb index b5f056e77f0..5067bb3cfd8 100644 --- a/examples/advanced/quantum_volume_errors.ipynb +++ b/examples/advanced/quantum_volume_errors.ipynb @@ -127,4 +127,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/advanced/quantum_volume_routing.ipynb b/examples/advanced/quantum_volume_routing.ipynb index 5a7ed328362..7c07e8ef05d 100644 --- a/examples/advanced/quantum_volume_routing.ipynb +++ b/examples/advanced/quantum_volume_routing.ipynb @@ -126,4 +126,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +}