Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Avoid task init if task is disabled" (#5591) #5696

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def _register_events(self):
self.event_manager.register_event('buddy_pokemon', parameters=('pokemon', 'iv', 'cp'))
self.event_manager.register_event('buddy_reward', parameters=('pokemon', 'family', 'candy_earned', 'candy'))
self.event_manager.register_event('buddy_walked', parameters=('pokemon', 'distance_walked', 'distance_needed'))
self.event_manager.register_event('task_disabled', parameters=('task_name',))

# ignore candy above threshold
self.event_manager.register_event(
Expand Down
1 change: 0 additions & 1 deletion pokemongo_bot/event_handlers/logging_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class LoggingHandler(EventHandler):
'softban_log': 'magenta',
'spin_limit': 'red',
'spun_pokestop': 'cyan',
'task_disabled': 'yellow',
'threw_berry_failed': 'red',
'transfer_log': 'magenta',
'unknown_spin_result': 'red',
Expand Down
11 changes: 0 additions & 11 deletions pokemongo_bot/tree_config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ def build(self):
'See config.json.*example for more information.')
continue

if not task_config.get("enabled", True):
msg = "Task {task_name} is disabled"
self.bot.event_manager.emit(
'task_disabled',
sender=self,
level='info',
formatted=msg,
data={'task_name': task_type}
)
continue

if self._is_plugin_task(task_type):
worker = self.plugin_loader.get_class(task_type)
else:
Expand Down
5 changes: 1 addition & 4 deletions tests/tree_config_builder_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest
import json
import os
from mock import MagicMock
from pokemongo_bot import PokemonGoBot, ConfigException, MismatchTaskApiVersion, TreeConfigBuilder, PluginLoader, BaseTask
from pokemongo_bot.cell_workers import HandleSoftBan, CatchPokemon
from pokemongo_bot.test.resources.plugin_fixture import FakeTask, UnsupportedApiTask
Expand All @@ -11,9 +10,7 @@ def convert_from_json(str):

class TreeConfigBuilderTest(unittest.TestCase):
def setUp(self):
self.bot = MagicMock()
self.bot.event_manager = MagicMock()
self.bot.event_manager.emit = lambda *args, **kwargs: None
self.bot = {}

def test_should_throw_on_no_type_key(self):
obj = convert_from_json("""[{
Expand Down