# Path: tldp/config.py
# def collectconfiguration(tag, argv):
#     '''main specification of command-line (and config file) shape'''
# 
#     ap = DefaultFreeArgumentParser()
#     ap.add_argument('--sourcedir', '--source-dir', '--source-directory',
#                     '-s',
#                     default=[], action=DirectoriesExist,
#                     help='a directory containing LDP source documents')
# 
#     ap.add_argument('--pubdir', '--output', '--outputdir', '--outdir',
#                     '-o',
#                     default=None, action=DirectoryExists,
#                     help='a directory containing LDP output documents')
# 
#     ap.add_argument('--builddir', '--build-dir', '--build-directory',
#                     '-d',
#                     default=None, action=DirectoryExists,
#                     help='a scratch directory used for building')
# 
#     ap.add_argument('--configfile', '--config-file', '--cfg',
#                     '-c',
#                     default=DEFAULT_CONFIGFILE,
#                     type=arg_isreadablefile,
#                     help='a configuration file')
# 
#     ap.add_argument('--loglevel',
#                     default=logging.ERROR, type=arg_isloglevel,
#                     help='set the loglevel')
# 
#     ap.add_argument('--verbose',
#                     action=StoreTrueOrNargBool, nargs='?', default=False,
#                     help='more info in --list/--detail [%(default)s]')
# 
#     ap.add_argument('--skip',
#                     default=[], action='append', type=str,
#                     help='skip this stem during processing')
# 
#     ap.add_argument('--resources',
#                     default=['images', 'resources'], action='append', type=str,
#                     help='subdirs to copy during build [%(default)s]')
# 
#     # -- and the distinct, mutually exclusive actions this script can perform
#     #
#     g = ap.add_mutually_exclusive_group()
#     g.add_argument('--publish',
#                    '-p',
#                    action='store_true', default=False,
#                    help='build and publish LDP documentation [%(default)s]')
# 
#     g.add_argument('--build',
#                    '-b',
#                    action='store_true', default=False,
#                    help='build LDP documentation [%(default)s]')
# 
#     g.add_argument('--script',
#                    '-S',
#                    action='store_true', default=False,
#                    help='dump runnable script [%(default)s]')
# 
#     g.add_argument('--detail', '--list',
#                    '-l',
#                    action='store_true', default=False,
#                    help='list elements of LDP system [%(default)s]')
# 
#     g.add_argument('--summary',
#                    '-t',
#                    action='store_true', default=False,
#                    help='dump inventory summary report [%(default)s]')
# 
#     g.add_argument('--doctypes', '--formats', '--format',
#                    '--list-doctypes', '--list-formats',
#                    '-T',
#                    action='store_true', default=False,
#                    help='show supported doctypes [%(default)s]')
# 
#     g.add_argument('--statustypes', '--list-statustypes',
#                    action='store_true', default=False,
#                    help='show status types and classes [%(default)s]')
# 
#     # -- collect up the distributed configuration fragments
#     #
#     for cls in tldp.typeguesser.knowndoctypes:
#         argparse_method = getattr(cls, 'argparse', None)
#         if argparse_method:
#             argparse_method(ap)
# 
#     cc = CascadingConfig(tag, ap, argv)
#     config, args = cc.parse()
#     return config, args


import unittest
from argparse import Namespace
from tldp.config import collectconfiguration
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project

from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals



# -- SUT


class TestConfigWorks(unittest.TestCase):

    def test_basic(self):
        config, args = collectconfiguration('tag', [])
        self.assertIsInstance(config, Namespace)
        self.assertIsInstance(args, list)

    def test_singleoptarg(self):

# Path: tldp/config.py
# def collectconfiguration(tag, argv):
#     '''main specification of command-line (and config file) shape'''
# 
#     ap = DefaultFreeArgumentParser()
#     ap.add_argument('--sourcedir', '--source-dir', '--source-directory',
#                     '-s',
#                     default=[], action=DirectoriesExist,
#                     help='a directory containing LDP source documents')
# 
#     ap.add_argument('--pubdir', '--output', '--outputdir', '--outdir',
#                     '-o',
#                     default=None, action=DirectoryExists,
#                     help='a directory containing LDP output documents')
# 
#     ap.add_argument('--builddir', '--build-dir', '--build-directory',
#                     '-d',
#                     default=None, action=DirectoryExists,
#                     help='a scratch directory used for building')
# 
#     ap.add_argument('--configfile', '--config-file', '--cfg',
#                     '-c',
#                     default=DEFAULT_CONFIGFILE,
#                     type=arg_isreadablefile,
#                     help='a configuration file')
# 
#     ap.add_argument('--loglevel',
#                     default=logging.ERROR, type=arg_isloglevel,
#                     help='set the loglevel')
# 
#     ap.add_argument('--verbose',
#                     action=StoreTrueOrNargBool, nargs='?', default=False,
#                     help='more info in --list/--detail [%(default)s]')
# 
#     ap.add_argument('--skip',
#                     default=[], action='append', type=str,
#                     help='skip this stem during processing')
# 
#     ap.add_argument('--resources',
#                     default=['images', 'resources'], action='append', type=str,
#                     help='subdirs to copy during build [%(default)s]')
# 
#     # -- and the distinct, mutually exclusive actions this script can perform
#     #
#     g = ap.add_mutually_exclusive_group()
#     g.add_argument('--publish',
#                    '-p',
#                    action='store_true', default=False,
#                    help='build and publish LDP documentation [%(default)s]')
# 
#     g.add_argument('--build',
#                    '-b',
#                    action='store_true', default=False,
#                    help='build LDP documentation [%(default)s]')
# 
#     g.add_argument('--script',
#                    '-S',
#                    action='store_true', default=False,
#                    help='dump runnable script [%(default)s]')
# 
#     g.add_argument('--detail', '--list',
#                    '-l',
#                    action='store_true', default=False,
#                    help='list elements of LDP system [%(default)s]')
# 
#     g.add_argument('--summary',
#                    '-t',
#                    action='store_true', default=False,
#                    help='dump inventory summary report [%(default)s]')
# 
#     g.add_argument('--doctypes', '--formats', '--format',
#                    '--list-doctypes', '--list-formats',
#                    '-T',
#                    action='store_true', default=False,
#                    help='show supported doctypes [%(default)s]')
# 
#     g.add_argument('--statustypes', '--list-statustypes',
#                    action='store_true', default=False,
#                    help='show status types and classes [%(default)s]')
# 
#     # -- collect up the distributed configuration fragments
#     #
#     for cls in tldp.typeguesser.knowndoctypes:
#         argparse_method = getattr(cls, 'argparse', None)
#         if argparse_method:
#             argparse_method(ap)
# 
#     cc = CascadingConfig(tag, ap, argv)
#     config, args = cc.parse()
#     return config, args


# Path: tests/test_config.py
import unittest
from argparse import Namespace
from tldp.config import collectconfiguration

# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project

from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals



# -- SUT


class TestConfigWorks(unittest.TestCase):

    def test_basic(self):
        config, args = collectconfiguration('tag', [])
        self.assertIsInstance(config, Namespace)
        self.assertIsInstance(args, list)

    def test_singleoptarg(self):

        config, args = collectconfiguration('tag', ['--pubdir', '.'])