Guidance on Testing an Extension

18 views
Skip to first unread message

Stephen McDowell

unread,
Apr 8, 2018, 7:02:03 PM4/8/18
to sphin...@googlegroups.com
Hello,

I’m getting a little turned around on what I should be using to test my extension, but my understanding from [1] and the linked issue [2] and resultant docs [3], that (as long as I’m willing to assume Sphinx>=1.6) I should be using the internal sphinx stuff.

I was able to get both @with_app from the sphinx-testing repo and @pytest.mark.sphinx to work on global function objects, but I think I want to be using make_app for my purpose.  I can’t find where the @pytest.mark.sphinx actually comes from though (forgive me, I’m very new to pytest, and still a little turned around with marking vs fixtures).

I’m using meta classes to generate some test_* methods, and doing @pytest.mark.sphinx inside the __new__ method of the meta class results in invalid bindings.  I can only get it to work on global functions, but I need to be able to create configuration values based off subclass definitions.

I’m trying to figure out how to use make_app (create one without mark / fixture decorators), but don’t understand the interface [4].  It’s yielding the make method, resulting in a generator.  I’ve been looking at a lot of the example test cases that use make_app, but theirs are always parameters and they are somehow able to make_app(…) aka their make_app is callable.

I was trying to use this because the docs on make_app say not to explicitly instantiate a SphinxTestApp.

Any advice on how to actually use this method?  Thanks for any advice / tips / steering in different directions!  In the end, without decorators, I just want to be able to instantiate a SphinxTestApp and override / set some configuration values, e.g. as the very first line of a class method.

-Stephen



Reply all
Reply to author
Forward
0 new messages