'Selecting doctests with attributes/tags in nosetest

I have a project containing both doctests and Unittest based tests that are run using nosetest.

Since some of the tests are slow and relies on an external database, I want to use tagging to select which tests to run. This is no problems with the Unittests, I simply use the attr decorator, but when I come to the doctests I can't seem to find a syntax for tagging.

In conclution: Is it possible to add attributes to doctests?



Solution 1:[1]

I don't have much experience in nosetest generally or in tagging specifically, but there is a way to get a doctest as a unittest.TestSuite using doctest.DocTestSuite. So perhaps you can use it to convert your doctest to testsuite and then add the tagging as you would for a regular unittest.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 asherbret