From 3b418daf684f01a126a56b58c83120af5914f576 Mon Sep 17 00:00:00 2001 From: A Farzat Date: Sun, 5 Oct 2025 07:24:22 +0300 Subject: Remove the redundant scheduler class This allows fetching the database every time, ensuring any updates to the database between fetches as captured. --- tests/feed.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/feed.py b/tests/feed.py index aaeb96a..97a60ef 100644 --- a/tests/feed.py +++ b/tests/feed.py @@ -1,7 +1,6 @@ from typing import Any from mongomock import MongoClient from pymongo.collection import Collection -from schedule import Scheduler from unittest import TestCase from components.subscriptions.main import Subscription from components.subscriptions.typing import SubsDict @@ -12,7 +11,6 @@ class TestFeeds(TestCase): def setUp(self) -> None: self.client: MongoClient[Any] = MongoClient(tz_aware=True) self.collection: Collection[SubsDict] = self.client.db.collection - self.scheduler: Scheduler = Scheduler() def test_insert(self) -> None: sub = Subscription( @@ -21,7 +19,6 @@ class TestFeeds(TestCase): time_between_fetches=5, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() sub_dict = self.collection.find_one({"_id": "yt:channel:bla"}) self.assertIsNotNone(sub_dict) @@ -35,10 +32,8 @@ class TestFeeds(TestCase): time_between_fetches=1, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() - sub.initialise_job() - self.scheduler.run_all() + sub.fetch() self.assertEqual(15, len(sub.videos)) sub_dict = self.collection.find_one({"_id": "yt:channel:hlgI3UHCOnwUGzWzbJ3H5w"}) self.assertIsNotNone(sub_dict) @@ -52,12 +47,10 @@ class TestFeeds(TestCase): time_between_fetches=1, ) sub._collection = self.collection - sub._scheduler = self.scheduler sub.insert() - sub.initialise_job() - self.scheduler.run_all() + sub.fetch() sub.link=r"tests/data/feed@ytnnews24@002.xml" - self.scheduler.run_all() + sub.fetch() self.assertEqual(16, len(sub.videos)) sub_dict = self.collection.find_one({"_id": "yt:channel:hlgI3UHCOnwUGzWzbJ3H5w"}) self.assertIsNotNone(sub_dict) -- cgit v1.2.3-70-g09d2