]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-pr-commits: add "code_test" for test_signed_off_by() test
authorKefu Chai <kchai@redhat.com>
Tue, 6 Oct 2020 15:13:41 +0000 (23:13 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 6 Oct 2020 15:54:00 +0000 (23:54 +0800)
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 <kchai@redhat.com>
ceph-pr-commits/build/conftest.py [new file with mode: 0644]
ceph-pr-commits/build/test_commits.py

diff --git a/ceph-pr-commits/build/conftest.py b/ceph-pr-commits/build/conftest.py
new file mode 100644 (file)
index 0000000..5ec0926
--- /dev/null
@@ -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")
index d48be08cddbd44a4ece721e4a12c06be86392eae..d474ad565933eaa7edca80d2b6c823bcf1d9fd9a 100644 (file)
@@ -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')