How to use prospector - 10 common examples

To help you get started, we’ve selected a few prospector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyCQA / prospector / tests / test_autodetect.py View on Github external
def _test(self, contents, *expected_names):
        names = find_from_imports(contents)
        self.assertEqual(set(expected_names), names)
github PyCQA / prospector / tests / test_message.py View on Github external
def test_char_order(self):

        locs = [
            Location('/tmp/path/module1.py', 'module1', 'somefunc', 10, 7),
            Location('/tmp/path/module1.py', 'module1', 'somefunc', 10, 0),
            Location('/tmp/path/module1.py', 'module1', 'somefunc', 10, 2)
        ]

        chars = [loc.character for loc in locs]
        expected = sorted(chars)

        self.assertEqual(expected, [loc.character for loc in sorted(locs)])
github PyCQA / prospector / tests / test_message.py View on Github external
def test_sort_between_none_lines(self):

        locs = [
            Location('/tmp/path/module1.py', 'module1', 'somefunc', 15, 0),
            Location('/tmp/path/module1.py', 'module1', 'somefunc', 10, 0),
            Location('/tmp/path/module1.py', 'module1', 'somefunc', -1, 0)
        ]

        lines = [(loc.line or -1) for loc in locs]
        expected = [None if l == -1 else l for l in sorted(lines)]

        self.assertEqual(expected, [loc.line for loc in sorted(locs)])
github PyCQA / prospector / tests / profiles / test_profile.py View on Github external
def _load(self, testname):
        profile_path = self._profile_path + [self._example_path(testname)]
        return ProspectorProfile.load('start', profile_path)
github PyCQA / prospector / tests / profiles / test_profile.py View on Github external
def test_empty_profile(self):
        """
        Verifies that a completely empty profile can still be parsed and have
        default values
        """
        profile = ProspectorProfile.load('empty_profile', self._profile_path, allow_shorthand=False)
        self.assertEqual([], profile.pylint['disable'])
github PyCQA / prospector / tests / profiles / test_profile.py View on Github external
def test_load_plugins(self):
        profile = ProspectorProfile.load('pylint_load_plugins', self._profile_path)
        self.assertEqual(['first_plugin', 'second_plugin'], profile.pylint['load-plugins'])
github PyCQA / prospector / tests / profiles / test_profile.py View on Github external
def test_strictness_equivalence(self):
        profile = self._load('strictness_equivalence')
        medium_strictness = ProspectorProfile.load('strictness_medium', self._profile_path)
        self.assertListEqual(sorted(profile.pylint['disable']), sorted(medium_strictness.pylint['disable']))
github PyCQA / prospector / tests / config / test_datatype.py View on Github external
def test_sanitize_abs_path_semicolon_posix(self):
        output_choice = OutputChoice(['xunit'])
        self.assertEqual(output_choice.sanitize('xunit;/home/test-results.xml'), ('xunit', ['/home/test-results.xml']))
github PyCQA / prospector / tests / config / test_datatype.py View on Github external
def test_sanitize_abs_path_semicolon_windows(self):
        output_choice = OutputChoice(['xunit'])
        self.assertEqual(output_choice.sanitize('xunit;C:\\testResults\\test-results.xml'), ('xunit', ['C:\\testResults\\test-results.xml']))
github PyCQA / prospector / tests / config / test_datatype.py View on Github external
def test_sanitize_abs_rel_path_semicolon_posix(self):
        output_choice = OutputChoice(['xunit'])
        self.assertEqual(output_choice.sanitize('xunit;/home/test-results.xml;./test-results.xml'),
                         ('xunit', ['/home/test-results.xml', './test-results.xml']))