How to use the vermin.detect_paths 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_detect_hidden_paths(self):
    tmp_fld = mkdtemp()
    files = [touch(tmp_fld, ".test.py"), touch(tmp_fld, "test.py"), touch(tmp_fld, ".test2.py"),
             touch(tmp_fld, "test2.py")]

    paths = detect_paths([tmp_fld], hidden=False)
    without_dot = [files[1], files[3]]
    self.assertEqualItems(without_dot, paths)

    paths2 = detect_paths([tmp_fld], hidden=True)
    self.assertEqualItems(files, paths2)

    rmtree(tmp_fld)
github netromdk / vermin / tests / general.py View on Github external
def test_detect_vermin_min_versions(self):
    paths = detect_paths([abspath("vermin")])
    processor = Processor()
    (mins, incomp, unique_versions, backports) = processor.process(paths)
    self.assertOnlyIn(((2, 7), (3, 0)), mins)
    self.assertEmpty(backports)
github netromdk / vermin / tests / general.py View on Github external
def test_detect_vermin_paths_directly(self):
    tmp_fld = mkdtemp()

    # Won't be picked by heuristics.
    f = touch(tmp_fld, "no-shebang")
    with open(f, mode="w") as fp:
      fp.write("print('this is code')")

    paths = detect_paths([tmp_fld])
    self.assertEmpty(paths)

    paths = detect_paths([join(tmp_fld, "no-shebang")])
    self.assertEqual(paths, [f])

    rmtree(tmp_fld)
github netromdk / vermin / tests / general.py View on Github external
def test_detect_paths(self):
    paths = detect_paths([abspath("vermin")])
    self.assertEqual(13, len(paths))
github netromdk / vermin / tests / general.py View on Github external
def test_detect_vermin_paths_directly(self):
    tmp_fld = mkdtemp()

    # Won't be picked by heuristics.
    f = touch(tmp_fld, "no-shebang")
    with open(f, mode="w") as fp:
      fp.write("print('this is code')")

    paths = detect_paths([tmp_fld])
    self.assertEmpty(paths)

    paths = detect_paths([join(tmp_fld, "no-shebang")])
    self.assertEqual(paths, [f])

    rmtree(tmp_fld)
github netromdk / vermin / tests / general.py View on Github external
def test_detect_hidden_paths(self):
    tmp_fld = mkdtemp()
    files = [touch(tmp_fld, ".test.py"), touch(tmp_fld, "test.py"), touch(tmp_fld, ".test2.py"),
             touch(tmp_fld, "test2.py")]

    paths = detect_paths([tmp_fld], hidden=False)
    without_dot = [files[1], files[3]]
    self.assertEqualItems(without_dot, paths)

    paths2 = detect_paths([tmp_fld], hidden=True)
    self.assertEqualItems(files, paths2)

    rmtree(tmp_fld)