Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:36:52+00:00 2026-06-14T08:36:52+00:00

In a big ReStructured Text file with many Python doctests, I have a testsetup

  • 0

In a big ReStructured Text file with many Python doctests, I have a testsetup block I want to run before each doctest, and some testsetup blocks I want to run before only some of the doctests. I know how to do this with groups, but is there a way to specify in what order the testsetup blocks are run?

Here’s a file, foo.rst:

.. testsetup:: *

  import sys
  sys.stderr.write('testsetup *' + chr(10))

.. testsetup:: my-group

  import sys
  sys.stderr.write('testsetup my-group' + chr(10))

.. doctest:: my-group

  >>> print 'test 1'
  test 1

When it’s run, I see:

testsetup my-group
testsetup *

Is there some way to force the opposite order, so the most-widely-applicable setup is run before the group-specific setup?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:36:53+00:00Added an answer on June 14, 2026 at 8:36 am

    Looking at the latest sphinx source code (see DocTestBuilder.test_doc), the answer is no, its not possible. At the moment, all the test blocks are collected in order and either assigned to a group or to a special add_to_all_groups. After this, the code in add_to_all_groups is appended to the list of code for each group, the result being that it will always run after group-specific code. It looks like it would be quite easy to write a patch to change this behaviour, or better still to provide it as an option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very big hadoop sequence file in the hdfs. what is the
I have a big list of rules in Mathematica, but I want to select
I have a big collection of millions entries. I want to remove efficiently all
I repair big android app and I have many custom dialogs which inherit from
We have few very big tables (3 tables, each 2 ~ 5 GB) in
I have a big string (let's call it a CSV file, though it isn't
i have a big domain lists file for a proxy filter. In another file
I have a big object I want to convert to JSON and send. However
I have a big makefile that I have configured with several phony targets. One
I have a big problem. I use excel auto filter function, at the end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.