Skip to content

Commit a2725ca

Browse files
committed
doc: fix skipping certain output types
Fixes #168 Without this fix we have the following error: ``` py.test --nbval notebooks/hummingbird.ipynb --sanitize-with notebooks/output-sanitize.cfg ================================================================ test session starts ================================================================= platform linux -- Python 3.7.10, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 rootdir: /repos/PAVICS-e2e-workflow-tests plugins: tornasync-0.6.0.post2, anyio-2.2.0, nbval-0.9.6, dash-1.20.0 collected 0 items INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/_pytest/main.py", line 269, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/_pytest/main.py", line 322, in _main INTERNALERROR> config.hook.pytest_collection(session=session) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/_pytest/main.py", line 333, in pytest_collection INTERNALERROR> session.perform_collect() INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/_pytest/main.py", line 620, in perform_collect INTERNALERROR> rep = collect_one_node(self) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/_pytest/runner.py", line 457, in collect_one_node INTERNALERROR> ihook.pytest_collectstart(collector=collector) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/opt/conda/envs/birdy/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/repos/PAVICS-e2e-workflow-tests/conftest.py", line 2, in pytest_collectstart INTERNALERROR> collector.skip_compare += 'text/html', 'application/javascript', INTERNALERROR> AttributeError: 'Session' object has no attribute 'skip_compare' =============================================================== no tests ran in 0.01s ================================================================ ```
1 parent 1397af8 commit a2725ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/source/index.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@
568568
"outputs": [],
569569
"source": [
570570
"def pytest_collectstart(collector):\n",
571-
" collector.skip_compare += 'text/html', 'application/javascript', 'stderr',"
571+
" if collector.fspath and collector.fspath.ext == '.ipynb':\n",
572+
" collector.skip_compare += 'text/html', 'application/javascript', 'stderr',"
572573
]
573574
}
574575
],
@@ -588,7 +589,7 @@
588589
"name": "python",
589590
"nbconvert_exporter": "python",
590591
"pygments_lexer": "ipython3",
591-
"version": "3.8.6"
592+
"version": "3.7.10"
592593
}
593594
},
594595
"nbformat": 4,

0 commit comments

Comments
 (0)