Closed mgiammar closed 2 years ago
What's the contents of your conftest.py
?
# -*- coding: utf-8 -*-
from pprint import pprint
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pytest
# LIBRARY IMPORTS
from mrsimulator import Coupling
from mrsimulator import signal_processing as sp
from mrsimulator import Simulator
from mrsimulator import Site
from mrsimulator import SpinSystem
from mrsimulator.methods import BlochDecayCTSpectrum
from mrsimulator.methods import Method2D
from mrsimulator.models import CzjzekDistribution
from mrsimulator.models import ExtCzjzekDistribution
from mrsimulator.spin_system.isotope import Isotope
from mrsimulator.spin_system.tensors import SymmetricTensor
from mrsimulator.transition import Transition
from mrsimulator.transition import TransitionPathway
from sybil import Sybil
from sybil.parsers.codeblock import PythonCodeBlockParser
from sybil.parsers.doctest import DocTestParser
from sybil.parsers.skip import Skip
from plot_directive_parser import PythonPlotParser
font = {"weight": "light", "size": 9}
matplotlib.rc("font", **font)
@pytest.fixture(autouse=True)
def test_models(doctest_namespace):
cz_model = CzjzekDistribution(0.5)
doctest_namespace["cz_model"] = cz_model
S0 = {"Cq": 1e6, "eta": 0.3}
ext_cz_model = ExtCzjzekDistribution(S0, eps=0.35)
doctest_namespace["ext_cz_model"] = ext_cz_model
@pytest.fixture(autouse=True)
def add_site(doctest_namespace):
# long pytest fixture; code removed for brevity
pass
pytest_collect_file = Sybil(
parsers=[
PythonCodeBlockParser(),
DocTestParser(),
],
pattern="*.rst",
fixtures=["add_site", "test_models"]
).pytest()
Looks like you haven't included the skip
parser in your config, here's an example: https://github.com/simplistix/sybil/blob/master/conftest.py#L13
I recently found Sybil as a way to test my static documentation code with pytest. On some of the documentation pages, Matplotlib
plt.show()
is invoked, and running pytest makes plots appear when each code block is executed.I added
.. skip: next
before the code blocks as shown belowHowever, plots are still opened when running pytest. Further, I tried the following code
which still throws the error
when running pytest.
Any ideas on why skip might be failing? Or am I using skip incorrectly?