Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_pipenv_mode_from_string(self):
self.assertEqual(Mode.from_string('pipenv'), Mode.PIPENV)
self.assertEqual(Mode.from_string('PIPENV'), Mode.PIPENV)
def test_get_poetry_mode_from_string(self):
self.assertEqual(Mode.from_string('poetry'), Mode.POETRY)
self.assertEqual(Mode.from_string('POETRY'), Mode.POETRY)
def test_get_poetry_mode_from_string(self):
self.assertEqual(Mode.from_string('poetry'), Mode.POETRY)
self.assertEqual(Mode.from_string('POETRY'), Mode.POETRY)
def test_get_pipenv_mode_from_string(self):
self.assertEqual(Mode.from_string('pipenv'), Mode.PIPENV)
self.assertEqual(Mode.from_string('PIPENV'), Mode.PIPENV)
def test_get_invalid_mode_from_string(self):
self.assertEqual(Mode.from_string('foo'), Mode.UNKNOWN)
self.assertEqual(Mode.from_string(None), Mode.UNDEFINED)
self.assertEqual(Mode.from_string(''), Mode.UNDEFINED)
def test_get_invalid_mode_from_string(self):
self.assertEqual(Mode.from_string('foo'), Mode.UNKNOWN)
self.assertEqual(Mode.from_string(None), Mode.UNDEFINED)
self.assertEqual(Mode.from_string(''), Mode.UNDEFINED)
def test_get_pythonpath_mode_from_string(self):
self.assertEqual(Mode.from_string('pythonpath'), Mode.PYTHONPATH)
self.assertEqual(Mode.from_string('PYTHONPATH'), Mode.PYTHONPATH)
"installed pre-commit hook."
)
term.info(
"Run 'autohooks check' to validate the current status of "
"the installed pre-commit hook."
)
else:
if not config.is_autohooks_enabled():
term.warning(
'autohooks is not enabled in your {} file. '
'Run \'autohooks check\' for more '
'details.'.format(str(pyproject_toml))
)
if args.mode:
mode = Mode.from_string(args.mode)
else:
mode = config.get_mode()
pre_commit_hook.write(mode=mode)
term.ok(
'autohooks pre-commit hook installed at {} using {} mode.'.format(
str(pre_commit_hook), str(mode.get_effective_mode())
)