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_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)
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)
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)
def test_detect_paths(self):
paths = detect_paths([abspath("vermin")])
self.assertEqual(13, len(paths))
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)
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)