Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _load(self, testname):
profile_path = self._profile_path + [self._example_path(testname)]
return ProspectorProfile.load('start', profile_path)
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'])
def test_load_plugins(self):
profile = ProspectorProfile.load('pylint_load_plugins', self._profile_path)
self.assertEqual(['first_plugin', 'second_plugin'], profile.pylint['load-plugins'])
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']))
# * anything provided as an argument
# * a directory called .prospector in the check path
# * the check path
# * prospector provided profiles
profile_path = config.profile_path
prospector_dir = os.path.join(path, '.prospector')
if os.path.exists(prospector_dir) and os.path.isdir(prospector_dir):
profile_path.append(prospector_dir)
profile_path.append(path)
profile_path.append(BUILTIN_PROFILE_PATH)
try:
forced_inherits = cmdline_implicit + extra_profiles
profile = ProspectorProfile.load(profile_name, profile_path, forced_inherits=forced_inherits)
except CannotParseProfile as cpe:
sys.stderr.write("Failed to run:\nCould not parse profile %s as it is not valid YAML\n%s\n" %
(cpe.filepath, cpe.get_parse_message()))
sys.exit(1)
except ProfileNotFound as nfe:
sys.stderr.write("Failed to run:\nCould not find profile %s. Search path: %s\n" %
(nfe.name, ':'.join(nfe.profile_path)))
sys.exit(1)
else:
return profile, strictness