From: Kefu Chai Date: Tue, 6 Oct 2020 15:13:41 +0000 (+0800) Subject: ceph-pr-commits: add "code_test" for test_signed_off_by() test X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4901d4c3d356caa0633d30cf27bb87362e18b3c7;p=ceph-build.git ceph-pr-commits: add "code_test" for test_signed_off_by() test this test should only apply to changes which modifies code. for the doc only changes, we should skip this test for lowering the bar for contributors willing to improve the document. Signed-off-by: Kefu Chai --- diff --git a/ceph-pr-commits/build/conftest.py b/ceph-pr-commits/build/conftest.py new file mode 100644 index 00000000..5ec09260 --- /dev/null +++ b/ceph-pr-commits/build/conftest.py @@ -0,0 +1,17 @@ +import pytest + + +def pytest_configure(config): + config.addinivalue_line( + "markers", "code_test: mark test to run against code related changes" + ) + + +def pytest_addoption(parser): + parser.addoption("--skip-code-test", action="store_true", + help="skip code tests") + + +def pytest_runtest_setup(item): + if "code_test" in item.keywords and item.config.getoption("--skip-code-test"): + pytest.skip("skipping due to --skip-code-test") diff --git a/ceph-pr-commits/build/test_commits.py b/ceph-pr-commits/build/test_commits.py index d48be08c..d474ad56 100644 --- a/ceph-pr-commits/build/test_commits.py +++ b/ceph-pr-commits/build/test_commits.py @@ -30,6 +30,7 @@ class TestCommits(object): 'git fetch origin +refs/heads/{target_branch}:refs/remotes/origin/{target_branch}'.format( target_branch=cls.target_branch)) + @pytest.mark.code_test def test_signed_off_by(self): signed_off_regex = r'Signed-off-by: \S.* <[^@]+@[^@]+\.[^@]+>' # '-z' puts a '\0' between commits, see later split('\0')