diff --git a/pyproject.toml b/pyproject.toml index 4fe297f..3f70380 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ typeguard = "^4.1.5" typing-extensions = "^4.9.0" [tool.pytest.ini_options] -addopts = "--cov --cov-report=term --cov-report=html --cov-branch" +addopts = "--cov --cov-report=term --cov-report=html --cov-branch --doctest-modules" filterwarnings = [ "error", "ignore:.*imghdr.*:DeprecationWarning:mediafile", diff --git a/test/cli_test.py b/test/cli_test.py index aea9439..bcbb4ba 100644 --- a/test/cli_test.py +++ b/test/cli_test.py @@ -2,6 +2,7 @@ import os.path import platform import shutil +import sys from pathlib import Path from time import sleep @@ -340,6 +341,9 @@ def test_unkown_collection(self): self.runcli("alt", "update", "unkown") assert str(e.value) == "Alternative collection 'unkown' not found." + @pytest.mark.skipif( + sys.platform.startswith("win"), reason="Image conversion not available" + ) def test_embed_art(self, tmp_path: Path): """Test that artwork is embedded and updated to match the source file. diff --git a/test/helper.py b/test/helper.py index 244e5d0..6753fb9 100644 --- a/test/helper.py +++ b/test/helper.py @@ -29,20 +29,23 @@ @contextmanager def capture_stdout(): - """Save stdout in a StringIO. + r"""Collect stdout in a StringIO while still outputting it. >>> with capture_stdout() as output: ... print('spam') ... + spam >>> output.getvalue() - 'spam' + 'spam\n' """ org = sys.stdout - sys.stdout = StringIO() + buffer = StringIO() + sys.stdout = buffer try: yield sys.stdout finally: sys.stdout = org + sys.stdout.write(buffer.getvalue()) @contextmanager