diff --git a/run-tests.xsh b/run-tests.xsh index 40b41b664..a271062f7 100755 --- a/run-tests.xsh +++ b/run-tests.xsh @@ -52,6 +52,9 @@ def qa(ns: argparse.Namespace): # todo: add xontrib folder here mypy xonsh --exclude xonsh/ply + echo "---------- Running news items check ----------" + pytest -m news + if __name__ == '__main__': parser = argparse.ArgumentParser() diff --git a/setup.cfg b/setup.cfg index 7e535713c..1bda063b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -114,3 +114,5 @@ ignore_missing_imports = True [tool:pytest] cache_dir = .cache/pytest +markers = + news: check changelog unit is valid rst diff --git a/tests/test_news.py b/tests/test_news.py index 3950de2d6..9c561c1d4 100644 --- a/tests/test_news.py +++ b/tests/test_news.py @@ -25,8 +25,8 @@ def check_news_file(fname): if "`" in l: if single_grave_reg.search(l): pytest.fail( - "{}:{}: single grave accents" - " are not valid rst".format(name, i + 1), + "{}:{}: single grave accents (`)" + " are not valid rst. Please use ``".format(name, i + 1), pytrace=True, ) @@ -61,7 +61,14 @@ def check_news_file(fname): pytest.fail("{}: invalid rst".format(name), pytrace=True) -@pytest.mark.parametrize("fname", list(os.scandir(NEWSDIR))) +@pytest.fixture(params=list(os.scandir(NEWSDIR))) +def fname(request): + if request.node.config.option.markexpr != "news": + pytest.skip("Run news items check explicitly") + return request.param + + +@pytest.mark.news def test_news(fname): base, ext = os.path.splitext(fname.path) assert "rst" in ext