mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Python: Copy Python extractor to codeql repo
This commit is contained in:
30
python/extractor/tests/test_file.py
Normal file
30
python/extractor/tests/test_file.py
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
import shutil
|
||||
import unittest
|
||||
import subprocess
|
||||
|
||||
import semmle.populator
|
||||
from tests import test_utils
|
||||
|
||||
class FileOptionTest(test_utils.ExtractorTest):
|
||||
|
||||
def __init__(self, name):
|
||||
super(FileOptionTest, self).__init__(name)
|
||||
|
||||
def test_file(self):
|
||||
self.run_extractor("-F", "tests/data/mod1.py")
|
||||
self.check_only_traps_exists_and_clear("mod1")
|
||||
|
||||
def test_no_file(self):
|
||||
try:
|
||||
self.run_extractor("-F", "this-file-does-not-exist.py")
|
||||
except subprocess.CalledProcessError as ex:
|
||||
self.assertEqual(ex.returncode, 1)
|
||||
|
||||
def test_no_module(self):
|
||||
try:
|
||||
self.run_extractor("this_module_does_not_exist")
|
||||
except subprocess.CalledProcessError as ex:
|
||||
self.assertEqual(ex.returncode, 1)
|
||||
Reference in New Issue
Block a user