3

I have created a Sphinx extension containing a directive.

Now I want to include unit tests before I start to refactor it. So using pytest I created a test file containing this fixture:

wide_format = __import__('sphinx-jsonschema.wide_format')

@pytest.fixture
def wideformat():
    state = Body(StateMachine(None, None))
    lineno = 1
    app = None

    return wide_format.WideFormat(state, lineno, app)

Which when used to create tests fails with errors complaining about the Nones in the instantiation of the StateMachine. I've tried to install some dummies, looked through docutil samples but can't find a working solution.

The problem is that State and StateMachine contain references to each other and I can't find a way to break that loop.

mzjn
  • 48,958
  • 13
  • 128
  • 248
LNoor
  • 91
  • 4

0 Answers0