From cfe5738151f92c7df2e23dc72f312905388f4988 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sun, 17 Mar 2024 19:21:41 +0100 Subject: [PATCH] Parametrize renamed comic module test --- tests/test_comicnames.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/test_comicnames.py b/tests/test_comicnames.py index 8d3b11e5e..a9d69c4a5 100644 --- a/tests/test_comicnames.py +++ b/tests/test_comicnames.py @@ -3,12 +3,15 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher import re +from operator import attrgetter + +import pytest from dosagelib.scraper import scrapers from dosagelib.plugins import old -class TestComicNames(object): +class TestComicNames: def test_names(self): for scraperobj in scrapers.all(): @@ -20,11 +23,11 @@ class TestComicNames(object): comicname = name assert re.sub("[^0-9a-zA-Z_]", "", comicname) == comicname - def test_renamed(self): - for scraperobj in scrapers.all(include_removed=True): - if not isinstance(scraperobj, old.Renamed): - continue - assert len(scraperobj.getDisabledReasons()) > 0 - # Renamed scraper should only point to an non-disabled scraper - newscraper = scrapers.find(scraperobj.newname) - assert len(newscraper.getDisabledReasons()) == 0 + @pytest.mark.parametrize(('scraperobj'), + [obj for obj in scrapers.all(include_removed=True) + if isinstance(obj, old.Renamed)], ids=attrgetter('name')) + def test_renamed(self, scraperobj): + assert len(scraperobj.getDisabledReasons()) > 0 + # Renamed scraper should only point to an non-disabled scraper + newscraper = scrapers.find(scraperobj.newname) + assert len(newscraper.getDisabledReasons()) == 0