mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-11 09:40:28 +03:00
Add a simple test for scanner
This commit is contained in:
parent
62d1c672f3
commit
5dee23f7a6
5 changed files with 68 additions and 0 deletions
33
tests/scanner.TestCase
Executable file
33
tests/scanner.TestCase
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import unittest
|
||||
import optparse
|
||||
from pathlib import Path
|
||||
from os.path import basename, dirname, realpath
|
||||
|
||||
from fdroidserver import scanner
|
||||
from fdroidserver.metadata import Build
|
||||
import fdroidserver.common
|
||||
|
||||
|
||||
class ScannerTest(unittest.TestCase):
|
||||
def test_scan_source_files(self):
|
||||
source_files = Path(dirname(realpath(__file__)), 'source-files')
|
||||
projects = {
|
||||
'Zillode': 1,
|
||||
'firebase-suspect': 1
|
||||
}
|
||||
for d in source_files.iterdir():
|
||||
fatal_problems = scanner.scan_source(d, Build())
|
||||
self.assertEqual(projects.get(basename(d), 0), fatal_problems)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
(fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
|
||||
|
||||
newSuite = unittest.TestSuite()
|
||||
newSuite.addTest(unittest.makeSuite(ScannerTest))
|
||||
unittest.main(failfast=False)
|
||||
Loading…
Add table
Add a link
Reference in a new issue