Пример #1
0
    def test_config(self):
        from pylama.config import get_parser, get_config

        parser = get_parser()
        self.assertTrue(parser)

        config = get_config()
        self.assertTrue(config)

        options = parse_options()
        self.assertTrue(options)
        self.assertTrue(options.skip)
        self.assertEqual(options.path, 'pylama')

        options = parse_options(['-l', 'pep257,pep8', '-i', 'E'])
        self.assertEqual(set(options.linters), set(['pep257', 'pep8']))
        self.assertEqual(options.ignore, ['E'])

        options = parse_options(['-l', 'gjslint,pep8', '-i', 'E:0010'])
        self.assertEqual(set(options.linters), set(['gjslint', 'pep8']))
        self.assertEqual(options.ignore, ['E:0010'])

        options = parse_options('-o dummy dummy.py'.split())
        self.assertEqual(
            set(options.linters), set(['pep8', 'mccabe', 'pyflakes']))
        self.assertEqual(options.skip, [])
Пример #2
0
def test_config():
    config = get_config()
    assert config

    options = parse_options()
    assert options
    assert options.skip
    assert not options.verbose
    assert options.paths == ['pylama']

    options = parse_options(['-l', 'pydocstyle,pycodestyle', '-i', 'E'])
    linters, _ = zip(*options.linters)
    assert set(linters) == set(['pydocstyle', 'pycodestyle'])
    assert options.ignore == ['E']

    options = parse_options('-o dummy dummy.py'.split())
    linters, _ = zip(*options.linters)
    assert set(linters) == set(['pycodestyle', 'mccabe', 'pyflakes'])
    assert options.skip == []
Пример #3
0
def test_config(parse_options):
    from pylama.config import get_config

    config = get_config()
    assert config

    options = parse_options()
    assert options
    assert options.skip
    assert options.max_line_length
    assert not options.verbose
    assert options.paths
    assert "pylama" in options.paths[0]

    options = parse_options(
        ["-l", "pydocstyle,pycodestyle,unknown", "-i", "E"])
    assert set(options.linters) == set(["pydocstyle", "pycodestyle"])
    assert options.ignore == {"E"}

    options = parse_options("-o dummy dummy.py".split())
    assert set(options.linters) == set(["pycodestyle", "mccabe", "pyflakes"])
    assert options.skip == []
Пример #4
0
    def test_config(self):
        from pylama.config import get_parser, get_config

        parser = get_parser()
        self.assertTrue(parser)

        config = get_config()
        self.assertTrue(config)

        options = parse_options()
        self.assertTrue(options)
        self.assertTrue(options.skip)
        self.assertEqual(options.path, 'pylama')

        options = parse_options(['-l', 'pep257,pep8', '-i', 'E'])
        linters, _ = zip(*options.linters)
        self.assertEqual(set(linters), set(['pep257', 'pep8']))
        self.assertEqual(options.ignore, ['E'])

        options = parse_options('-o dummy dummy.py'.split())
        linters, _ = zip(*options.linters)
        self.assertEqual(set(linters), set(['pep8', 'mccabe', 'pyflakes']))
        self.assertEqual(options.skip, [])