How to use the vermin.process_individual function in vermin

To help you get started, we’ve selected a few vermin 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 netromdk / vermin / tests / general.py View on Github external
def test_process_invalid_versions(self):
    fp = NamedTemporaryFile(suffix=".py", delete=False)
    fp.write(b"long(42)\n")  # long is a v2 feature: 2.0 !3
    fp.write(b"breakpoint()\n")  # breakpoint(): !2, 3.7
    fp.close()
    proc_res = process_individual((fp.name, self.config))
    self.assertEqual(proc_res.mins, None)
    self.assertTrue(proc_res.text.startswith("Versions could not be combined"))
    self.assertEmpty(proc_res.bps)
    os.remove(fp.name)
github netromdk / vermin / tests / general.py View on Github external
def test_process_file_not_Found(self):
    if current_version() >= 3.0:
      exc = FileNotFoundError
    else:
      exc = Exception
    with self.assertRaises(exc):
      process_individual(("nonexistent", self.config))
github netromdk / vermin / tests / general.py View on Github external
def test_process_file_using_backport(self):
    fp = NamedTemporaryFile(suffix=".py", delete=False)
    fp.write(b"import typing\n")
    fp.close()
    proc_res = process_individual((fp.name, self.config))
    self.assertEmpty(proc_res.text)
    self.assertEqualItems(["typing"], proc_res.bps)
    os.remove(fp.name)
github netromdk / vermin / tests / general.py View on Github external
def test_process_runtests_py(self):
    proc_res = process_individual((sys.argv[0], self.config))
    self.assertEqual(basename(proc_res.path), "runtests.py")
    self.assertEqual(proc_res.mins, [(2, 7), (3, 0)])
    self.assertEmpty(proc_res.text)
    self.assertEmpty(proc_res.bps)
github netromdk / vermin / tests / general.py View on Github external
def test_process_syntax_error(self):
    # Syntax error triggers minimum versions [0, 0].
    fp = NamedTemporaryFile(suffix=".py", delete=False)
    fp.write(b"(")  # SyntaxError: unexpected EOF while parsing
    fp.close()
    proc_res = process_individual((fp.name, self.config))
    self.assertEqual(proc_res.mins, [(0, 0), (0, 0)])
    self.assertEmpty(proc_res.text)
    self.assertEmpty(proc_res.bps)
    os.remove(fp.name)