diff --git a/senpy/plugins/__init__.py b/senpy/plugins/__init__.py index b3d5b0e..1510fd4 100644 --- a/senpy/plugins/__init__.py +++ b/senpy/plugins/__init__.py @@ -95,12 +95,22 @@ class Plugin(with_metaclass(PluginMeta, models.Plugin)): self.id = 'plugins/{}_{}'.format(self['name'], self['version']) self.is_activated = False self._lock = threading.Lock() - self.data_folder = data_folder or os.getcwd() self._directory = os.path.abspath(os.path.dirname(inspect.getfile(self.__class__))) - self._data_paths = ['', - self._directory, - os.path.join(self._directory, 'data'), - self.data_folder] + + data_folder = data_folder or os.getcwd() + subdir = os.path.join(data_folder, self.name) + + self._data_paths = [ + data_folder, + subdir, + self._directory, + os.path.join(self._directory, 'data'), + ] + + if os.path.exists(subdir): + data_folder = subdir + self.data_folder = data_folder + self._log = logging.getLogger('{}.{}'.format(__name__, self.name)) @property diff --git a/senpy/plugins/sentiment/sentiment140/sentiment140.py b/senpy/plugins/sentiment/sentiment140/sentiment140.py index d10e010..e97e73c 100644 --- a/senpy/plugins/sentiment/sentiment140/sentiment140.py +++ b/senpy/plugins/sentiment/sentiment140/sentiment140.py @@ -41,7 +41,7 @@ class Sentiment140Plugin(SentimentPlugin): To avoid calling the sentiment140 API, we will mock the results from requests. ''' - from senpy.test import patch_requests + from senpy.testing import patch_requests expected = {"data": [{"polarity": 4}]} with patch_requests(expected) as (request, response): super(Sentiment140Plugin, self).test(*args, **kwargs) diff --git a/tests/test_client.py b/tests/test_client.py index 8550563..d2a48f8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,6 +1,6 @@ from unittest import TestCase -from senpy.test import patch_requests +from senpy.testing import patch_requests from senpy.client import Client from senpy.models import Results, Plugins, Error from senpy.plugins import AnalysisPlugin diff --git a/tests/test_test.py b/tests/test_test.py index d5beea8..c1d2d5b 100644 --- a/tests/test_test.py +++ b/tests/test_test.py @@ -2,7 +2,7 @@ from unittest import TestCase import requests import json -from senpy.test import patch_requests +from senpy.testing import patch_requests from senpy.models import Results