def test_use_cases_doc(self):
        """ Method to test the use cases rst documentation.
        """
        # Get all the use cases
        module_path = my_module.__path__[0]
        pilots = load_pilots(module_path, module_path, "capsul.sphinxext.test")
        self.assertTrue(len(pilots) == 1)
        self.assertTrue("capsul.sphinxext.test.test_usercases_doc" in pilots)
        self.assertTrue(len(pilots["capsul.sphinxext.test.test_usercases_doc"]) == 1)

        # Generate the writer object
        docwriter = UseCasesHelperWriter(pilots["capsul.sphinxext.test.test_usercases_doc"])
        rstdoc = docwriter.write_usecases_docs(returnrst=True)
        self.assertTrue("capsul.sphinxext.test.test_usercases_doc.pilot_dummy_test" in rstdoc)
Exemple #2
0
    def test_use_cases_doc(self):
        """ Method to test the use cases rst documentation.
        """
        # Get all the use cases
        module_path = my_module.__path__[0]
        pilots = load_pilots(module_path, module_path, "capsul.sphinxext.test")
        self.assertTrue(len(pilots) == 1)
        self.assertTrue("capsul.sphinxext.test.test_usercases_doc" in pilots)
        self.assertTrue(
            len(pilots["capsul.sphinxext.test.test_usercases_doc"]) == 1)

        # Generate the writer object
        docwriter = UseCasesHelperWriter(
            pilots["capsul.sphinxext.test.test_usercases_doc"])
        rstdoc = docwriter.write_usecases_docs(returnrst=True)
        self.assertTrue(
            "capsul.sphinxext.test.test_usercases_doc.pilot_dummy_test" in
            rstdoc)
# Capsul import
from capsul.sphinxext.usecasesdocgen import UseCasesHelperWriter
from capsul.sphinxext.load_pilots import load_pilots


# Get all the pilots
# > first find the package location
try:
    __import__(options.module)
except:
    logging.error("Can't load module {0}".format(options.module))
    exit(2)
module = sys.modules[options.module]
module_path = module.__path__[0]
# > then load the pilots
pilots = load_pilots(module_path, module_path, options.module)

# Sort all the pilots
# > from the pilots full path 'm1.m2.pipeline' get the module name 'm2'
module_names = set([x.split(".")[1] for x in pilots])
# > sort each pilot according to its module name.
# > the result is a dict of the form 'd[m2] = [pilot1, ...]'
sorted_pilots = {}
for module_name, pilots in pilots.items():
    name = module_name.split(".")[1]
    sorted_pilots.setdefault(name, []).extend(pilots)

# Generate use cases reST
for module_name, pilots in sorted_pilots.items():

    # Where the documentation will be written: a relative path from the
Exemple #4
0
# Capsul import
from capsul.sphinxext.usecasesdocgen import UseCasesHelperWriter
from capsul.sphinxext.load_pilots import load_pilots

# Get all the pilots
# > first find the package location
try:
    __import__(options.module)
except ImportError:
    logging.error("Can't load module {0}".format(options.module))
    exit(2)
module = sys.modules[options.module]
module_path = module.__path__[0]
# > then load the pilots
pilots = load_pilots(module_path, module_path, options.module)

# Sort all the pilots
# > from the pilots full path 'm1.m2.pipeline' get the module name 'm2'
module_names = set([x.split(".")[1] for x in pilots])
# > sort each pilot according to its module name.
# > the result is a dict of the form 'd[m2] = [pilot1, ...]'
sorted_pilots = {}
for module_name, pilots in pilots.items():
    name = module_name.split(".")[1]
    sorted_pilots.setdefault(name, []).extend(pilots)

# Generate use cases reST
for module_name, pilots in sorted_pilots.items():

    # Where the documentation will be written: a relative path from the