{"action":"created","issue":{"url":"https://api.github.com/repos/celery/celery/issues/2498","labels_url":"https://api.github.com/repos/celery/celery/issues/2498/labels{/name}","comments_url":"https://api.github.com/repos/celery/celery/issues/2498/comments","events_url":"https://api.github.com/repos/celery/celery/issues/2498/events","html_url":"https://github.com/celery/celery/issues/2498","id":57362801,"number":2498,"title":"Something in celery/tests prevents tasks from loading with a name of tests.foo...","user":{"login":"AngledLuffa","id":3411033,"avatar_url":"https://avatars.githubusercontent.com/u/3411033?v=3","gravatar_id":"","url":"https://api.github.com/users/AngledLuffa","html_url":"https://github.com/AngledLuffa","followers_url":"https://api.github.com/users/AngledLuffa/followers","following_url":"https://api.github.com/users/AngledLuffa/following{/other_user}","gists_url":"https://api.github.com/users/AngledLuffa/gists{/gist_id}","starred_url":"https://api.github.com/users/AngledLuffa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngledLuffa/subscriptions","organizations_url":"https://api.github.com/users/AngledLuffa/orgs","repos_url":"https://api.github.com/users/AngledLuffa/repos","events_url":"https://api.github.com/users/AngledLuffa/events{/privacy}","received_events_url":"https://api.github.com/users/AngledLuffa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-11T19:17:12Z","updated_at":"2015-02-11T19:41:53Z","closed_at":"2015-02-11T19:19:17Z","body":"We are constructing a Celery as follows:\r\n\r\n```\r\nremote = Celery('ourcompany', CELERY_TASK_SERIALIZER = 'json',\r\n                include = ['app.tasks.foo', 'app.tasks.bar'])\r\n```\r\n\r\nWe have a \"tests\" directory which holds our unit tests.  If we put a task in our tests directory, celery can't load it:\r\n\r\n```\r\nremote = Celery('ourcompany', CELERY_TASK_SERIALIZER = 'json',\r\n                include = ['app.tasks.foo', 'app.tasks.bar', 'tests.foo'])\r\n```\r\n\r\nThis gives us the error:\r\n\r\n```\r\netc\r\netc\r\n  File \"/Library/Python/2.7/site-packages/celery/utils/imports.py\", line 101, in import_from_cwd\r\n    return imp(module, package=package)\r\n  File \"/Library/Python/2.7/site-packages/celery/loaders/base.py\", line 106, in import_module\r\n    return importlib.import_module(module, package=package)\r\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py\", line 37, in import_module\r\n    __import__(name)\r\nImportError: No module named foo\r\n```\r\n\r\nVarious experiments show that it is something in celery/tests causing the import error.  For example, if we rename our test to \"testz.foo\" with a \"z\" instead of an \"s\", then this works:\r\n\r\n```\r\nremote = Celery('ourcompany', CELERY_TASK_SERIALIZER = 'json',\r\n                include = ['app.tasks.foo', 'app.tasks.bar', 'testz.foo'])\r\n```\r\n\r\nAlso, if we do something I personally consider hideous, this works:\r\n\r\n```\r\nsys.path.insert(0, os.path.abspath(__file__ + \"/../../\"))  # eg, the codebase's root directory\r\nremote = Celery('ourcompany', CELERY_TASK_SERIALIZER = 'json',\r\n                include = ['app.tasks.foo', 'app.tasks.bar', 'tests.foo'])\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/celery/celery/issues/comments/73949640","html_url":"https://github.com/celery/celery/issues/2498#issuecomment-73949640","issue_url":"https://api.github.com/repos/celery/celery/issues/2498","id":73949640,"user":{"login":"AngledLuffa","id":3411033,"avatar_url":"https://avatars.githubusercontent.com/u/3411033?v=3","gravatar_id":"","url":"https://api.github.com/users/AngledLuffa","html_url":"https://github.com/AngledLuffa","followers_url":"https://api.github.com/users/AngledLuffa/followers","following_url":"https://api.github.com/users/AngledLuffa/following{/other_user}","gists_url":"https://api.github.com/users/AngledLuffa/gists{/gist_id}","starred_url":"https://api.github.com/users/AngledLuffa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngledLuffa/subscriptions","organizations_url":"https://api.github.com/users/AngledLuffa/orgs","repos_url":"https://api.github.com/users/AngledLuffa/repos","events_url":"https://api.github.com/users/AngledLuffa/events{/privacy}","received_events_url":"https://api.github.com/users/AngledLuffa/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T19:41:53Z","updated_at":"2015-02-11T19:41:53Z","body":"It's a name conflict elsewhere in our path."}}