Currently, how to run the check-package test-suite is thoroughly under- documented. There is one hint in the commit log for commitfc254881e6(utils/checkpackagelib: add unit tests), and another in commit242e9d72e7(utils/docker-run: new script); the former is hard to find, and the latter is about an unrelated script, so harder yet to find... Add a new option to check-package, that will make it run its test-suite. Since pytest is only needed for the test-suite, only import it in that case. pytest will be default create a cache of the tests (not sure what it is about, though), so instruct it not to (esp. since the tree can be read-only). Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br> [Arnout: move the code into checkpackagelib.base] Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
39 lines
836 B
Python
39 lines
836 B
Python
# See utils/checkpackagelib/readme.txt before editing this file.
|
|
import re
|
|
import os
|
|
|
|
|
|
class _CheckFunction(object):
|
|
def __init__(self, filename, url_to_manual):
|
|
self.filename = filename
|
|
self.url_to_manual = url_to_manual
|
|
self.disable = re.compile(r"^\s*# check-package .*\b{}\b".format(self.__class__.__name__))
|
|
|
|
def before(self):
|
|
pass
|
|
|
|
def check_line(self, lineno, text):
|
|
pass
|
|
|
|
def after(self):
|
|
pass
|
|
|
|
|
|
class _Tool(object):
|
|
def __init__(self, filename):
|
|
self.filename = filename
|
|
|
|
def run(self):
|
|
pass
|
|
|
|
def hint(self):
|
|
return ""
|
|
|
|
|
|
def run_test_suite():
|
|
import pytest
|
|
return pytest.main(
|
|
# Disable writing/loading a cache with: -p no:cacheprovider
|
|
["-v", "-p", "no:cacheprovider", os.path.dirname(__file__)]
|
|
)
|