diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py index a1266c879..a15a0d90f 100644 --- a/scrapy/utils/project.py +++ b/scrapy/utils/project.py @@ -71,15 +71,3 @@ def get_project_settings(): settings.setdict(env_overrides, priority='project') return settings - -def get_project_path(): - """Return the Python path of the current project. - - This fails when the settings module does not live in the project's root. - """ - if not inside_project(): - raise NotConfigured("Not inside a project") - settings_module_path = os.environ.get(ENVVAR) - if not settings_module_path: - raise NotConfigured("Unable to locate project's python path") - return settings_module_path.rsplit('.', 1)[0] diff --git a/tests/test_utils_project.py b/tests/test_utils_project.py deleted file mode 100644 index cea4d9950..000000000 --- a/tests/test_utils_project.py +++ /dev/null @@ -1,27 +0,0 @@ -import os -from tests import mock -import unittest - -from scrapy.exceptions import NotConfigured -from scrapy.utils.project import get_project_path, inside_project - - -class UtilsProjectTestCase(unittest.TestCase): - - @mock.patch('scrapy.utils.project.inside_project', return_value=True) - def test_get_project_path(self, mock_ip): - def _test(settingsmod, expected): - with mock.patch.dict('os.environ', - {'SCRAPY_SETTINGS_MODULE': settingsmod}): - self.assertEqual(get_project_path(), expected) - _test('project.settings', 'project') - _test('project.othername', 'project') - _test('nested.project.settings', 'nested.project') - - with mock.patch.dict('os.environ', {}, clear=True): - self.assertRaises(NotConfigured, get_project_path) - - mock_ip.return_value = False - with mock.patch.dict('os.environ', - {'SCRAPY_SETTINGS_MODULE': 'some.settings'}): - self.assertRaises(NotConfigured, get_project_path)