Skip to content

Commit

Permalink
[tests] detect calls to 'request()' during initialization (#6387)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 27, 2024
1 parent 3cbf15a commit 061b27f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,17 @@ def test_unique_pattern_matches(self):

def test_init(self):
"""Test for exceptions in Extractor.initialize() and .finalize()"""
def fail_request(*args, **kwargs):
self.fail("called 'request() during initialization")

for cls in extractor.extractors():
if cls.category == "ytdl":
continue
extr = cls.from_url(cls.example)
if not extr and cls.basecategory and not cls.instances:
continue

extr.request = fail_request
extr.initialize()
extr.finalize()

Expand Down

0 comments on commit 061b27f

Please sign in to comment.