From a7d844df76cd4b95a717f21ef5aa6167477b6733 Mon Sep 17 00:00:00 2001
From: ulif <uli@gnufix.de>
Date: Tue, 27 Feb 2018 11:24:37 +0100
Subject: [PATCH] Disable packaging-related tests by default.

We now `pytest.mark` tests that are mainly related to packaging and
disable them by default. This is a first workaround for broken
year-checks. These tests blindly fail when the current year does not
equal the one mentioned in docs and version string.

In fact the tests should compare the year in docs/version string with
the year of "current" commit (with "current commit" being the one
representing the tested codebase). Another issue to be addressed.

All tests can be run by: `py.test -m ""`, the packaging-only tests can
be run by `py.test -m "packaging"`. `tox` got a new env called `pkg`.
---
 tests/test_diceware.py |  1 +
 tests/test_manpage.py  |  1 +
 tox.ini                | 11 +++++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/test_diceware.py b/tests/test_diceware.py
index 9568778..dedbe76 100644
--- a/tests/test_diceware.py
+++ b/tests/test_diceware.py
@@ -251,6 +251,7 @@ class TestDicewareModule(object):
         assert err == ''
         assert __version__ in out
 
+    @pytest.mark.packaging
     def test_print_version_current_year(self, capsys):
         # in version infos we display the current year
         print_version()
diff --git a/tests/test_manpage.py b/tests/test_manpage.py
index acb4a4c..9982718 100644
--- a/tests/test_manpage.py
+++ b/tests/test_manpage.py
@@ -17,6 +17,7 @@ def manpage(request):
 
 class TestManpage(object):
 
+    @pytest.mark.packaging
     def test_manpage_contains_current_year(self, manpage):
         # the current year appears at least in the manpage
         assert str(datetime.datetime.now().year) in manpage
diff --git a/tox.ini b/tox.ini
index 06a7bca..86a5899 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,9 @@
 [pytest]
-addopts = --doctest-modules --doctest-glob='*.rst'
+addopts = --doctest-modules --doctest-glob='*.rst' -m 'not packaging'
           diceware tests docs README.rst
 
 [tox]
-envlist = flake8, pypy, py26, py27, py33, py34, py35, py36, coverage
+envlist = flake8, pypy, py26, py27, py33, py34, py35, py36, coverage, pkg
 
 [testenv]
 usedevelop=True
@@ -35,3 +35,10 @@ commands=
   coverage erase
   coverage run setup.py test
   coverage report --include='diceware*,setup.py' -m --fail-under=100
+
+[testenv:pkg]
+# run only tests marked as 'packaging'-related
+deps=
+  pytest==3.2.5
+commands=
+  py.test -m 'packaging'
-- 
GitLab