diff --git a/tests/data/module_finder/module_finder_testmod/__init__.py b/tests/data/importer/module_finder_testmod/__init__.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/__init__.py rename to tests/data/importer/module_finder_testmod/__init__.py diff --git a/tests/data/module_finder/module_finder_testmod/empty_mod.py b/tests/data/importer/module_finder_testmod/empty_mod.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/empty_mod.py rename to tests/data/importer/module_finder_testmod/empty_mod.py diff --git a/tests/data/module_finder/module_finder_testmod/regular_mod.py b/tests/data/importer/module_finder_testmod/regular_mod.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/regular_mod.py rename to tests/data/importer/module_finder_testmod/regular_mod.py diff --git a/tests/data/module_finder/module_finder_testmod/sibling_dep_mod_abs_import.py b/tests/data/importer/module_finder_testmod/sibling_dep_mod_abs_import.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/sibling_dep_mod_abs_import.py rename to tests/data/importer/module_finder_testmod/sibling_dep_mod_abs_import.py diff --git a/tests/data/module_finder/module_finder_testmod/sibling_dep_mod_py2_import.py b/tests/data/importer/module_finder_testmod/sibling_dep_mod_py2_import.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/sibling_dep_mod_py2_import.py rename to tests/data/importer/module_finder_testmod/sibling_dep_mod_py2_import.py diff --git a/tests/data/module_finder/module_finder_testmod/sibling_dep_mod_rel_import.py b/tests/data/importer/module_finder_testmod/sibling_dep_mod_rel_import.py similarity index 100% rename from tests/data/module_finder/module_finder_testmod/sibling_dep_mod_rel_import.py rename to tests/data/importer/module_finder_testmod/sibling_dep_mod_rel_import.py diff --git a/tests/data/module_finder/pkg_like_ansible/__init__.py b/tests/data/importer/pkg_like_ansible/__init__.py similarity index 100% rename from tests/data/module_finder/pkg_like_ansible/__init__.py rename to tests/data/importer/pkg_like_ansible/__init__.py diff --git a/tests/data/module_finder/pkg_like_ansible/module_utils/__init__.py b/tests/data/importer/pkg_like_ansible/module_utils/__init__.py similarity index 100% rename from tests/data/module_finder/pkg_like_ansible/module_utils/__init__.py rename to tests/data/importer/pkg_like_ansible/module_utils/__init__.py diff --git a/tests/data/module_finder/pkg_like_ansible/module_utils/distro/__init__.py b/tests/data/importer/pkg_like_ansible/module_utils/distro/__init__.py similarity index 100% rename from tests/data/module_finder/pkg_like_ansible/module_utils/distro/__init__.py rename to tests/data/importer/pkg_like_ansible/module_utils/distro/__init__.py diff --git a/tests/data/module_finder/pkg_like_ansible/module_utils/distro/_distro.py b/tests/data/importer/pkg_like_ansible/module_utils/distro/_distro.py similarity index 100% rename from tests/data/module_finder/pkg_like_ansible/module_utils/distro/_distro.py rename to tests/data/importer/pkg_like_ansible/module_utils/distro/_distro.py diff --git a/tests/data/module_finder/pkg_like_plumbum/__init__.py b/tests/data/importer/pkg_like_plumbum/__init__.py similarity index 100% rename from tests/data/module_finder/pkg_like_plumbum/__init__.py rename to tests/data/importer/pkg_like_plumbum/__init__.py diff --git a/tests/data/module_finder/pkg_like_plumbum/colors.py b/tests/data/importer/pkg_like_plumbum/colors.py similarity index 100% rename from tests/data/module_finder/pkg_like_plumbum/colors.py rename to tests/data/importer/pkg_like_plumbum/colors.py diff --git a/tests/data/module_finder/simple_pkg/__init__.py b/tests/data/importer/simple_pkg/__init__.py similarity index 100% rename from tests/data/module_finder/simple_pkg/__init__.py rename to tests/data/importer/simple_pkg/__init__.py diff --git a/tests/data/module_finder/simple_pkg/a.py b/tests/data/importer/simple_pkg/a.py similarity index 100% rename from tests/data/module_finder/simple_pkg/a.py rename to tests/data/importer/simple_pkg/a.py diff --git a/tests/data/module_finder/simple_pkg/b.py b/tests/data/importer/simple_pkg/b.py similarity index 100% rename from tests/data/module_finder/simple_pkg/b.py rename to tests/data/importer/simple_pkg/b.py diff --git a/tests/data/module_finder/simple_pkg/imports_replaces_self.py b/tests/data/importer/simple_pkg/imports_replaces_self.py similarity index 100% rename from tests/data/module_finder/simple_pkg/imports_replaces_self.py rename to tests/data/importer/simple_pkg/imports_replaces_self.py diff --git a/tests/data/module_finder/simple_pkg/ping.py b/tests/data/importer/simple_pkg/ping.py similarity index 100% rename from tests/data/module_finder/simple_pkg/ping.py rename to tests/data/importer/simple_pkg/ping.py diff --git a/tests/data/module_finder/simple_pkg/replaces_self.py b/tests/data/importer/simple_pkg/replaces_self.py similarity index 100% rename from tests/data/module_finder/simple_pkg/replaces_self.py rename to tests/data/importer/simple_pkg/replaces_self.py diff --git a/tests/data/module_finder/six_brokenpkg/__init__.py b/tests/data/importer/six_brokenpkg/__init__.py similarity index 100% rename from tests/data/module_finder/six_brokenpkg/__init__.py rename to tests/data/importer/six_brokenpkg/__init__.py diff --git a/tests/data/module_finder/six_brokenpkg/_six.py b/tests/data/importer/six_brokenpkg/_six.py similarity index 100% rename from tests/data/module_finder/six_brokenpkg/_six.py rename to tests/data/importer/six_brokenpkg/_six.py diff --git a/tests/data/module_finder/webproject/manage.py b/tests/data/importer/webproject/manage.py similarity index 100% rename from tests/data/module_finder/webproject/manage.py rename to tests/data/importer/webproject/manage.py diff --git a/tests/data/module_finder/webproject/serve_django_app.py b/tests/data/importer/webproject/serve_django_app.py similarity index 100% rename from tests/data/module_finder/webproject/serve_django_app.py rename to tests/data/importer/webproject/serve_django_app.py diff --git a/tests/data/module_finder/webproject/webapp/__init__.py b/tests/data/importer/webproject/webapp/__init__.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/__init__.py rename to tests/data/importer/webproject/webapp/__init__.py diff --git a/tests/data/module_finder/webproject/webapp/admin.py b/tests/data/importer/webproject/webapp/admin.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/admin.py rename to tests/data/importer/webproject/webapp/admin.py diff --git a/tests/data/module_finder/webproject/webapp/apps.py b/tests/data/importer/webproject/webapp/apps.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/apps.py rename to tests/data/importer/webproject/webapp/apps.py diff --git a/tests/data/module_finder/webproject/webapp/migrations/__init__.py b/tests/data/importer/webproject/webapp/migrations/__init__.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/migrations/__init__.py rename to tests/data/importer/webproject/webapp/migrations/__init__.py diff --git a/tests/data/module_finder/webproject/webapp/models.py b/tests/data/importer/webproject/webapp/models.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/models.py rename to tests/data/importer/webproject/webapp/models.py diff --git a/tests/data/module_finder/webproject/webapp/tests.py b/tests/data/importer/webproject/webapp/tests.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/tests.py rename to tests/data/importer/webproject/webapp/tests.py diff --git a/tests/data/module_finder/webproject/webapp/views.py b/tests/data/importer/webproject/webapp/views.py similarity index 100% rename from tests/data/module_finder/webproject/webapp/views.py rename to tests/data/importer/webproject/webapp/views.py diff --git a/tests/data/module_finder/webproject/webproject/__init__.py b/tests/data/importer/webproject/webproject/__init__.py similarity index 100% rename from tests/data/module_finder/webproject/webproject/__init__.py rename to tests/data/importer/webproject/webproject/__init__.py diff --git a/tests/data/module_finder/webproject/webproject/settings.py b/tests/data/importer/webproject/webproject/settings.py similarity index 100% rename from tests/data/module_finder/webproject/webproject/settings.py rename to tests/data/importer/webproject/webproject/settings.py diff --git a/tests/data/module_finder/webproject/webproject/urls.py b/tests/data/importer/webproject/webproject/urls.py similarity index 100% rename from tests/data/module_finder/webproject/webproject/urls.py rename to tests/data/importer/webproject/webproject/urls.py diff --git a/tests/data/module_finder/webproject/webproject/wsgi.py b/tests/data/importer/webproject/webproject/wsgi.py similarity index 100% rename from tests/data/module_finder/webproject/webproject/wsgi.py rename to tests/data/importer/webproject/webproject/wsgi.py diff --git a/tests/module_finder_test.py b/tests/module_finder_test.py index a77f1084..d35fb382 100644 --- a/tests/module_finder_test.py +++ b/tests/module_finder_test.py @@ -7,9 +7,7 @@ import unittest2 import mitogen.master import testlib - -MODS_PATH = testlib.data_path('module_finder') -sys.path.append(MODS_PATH) +from testlib import MODS_DIR class ConstructorTest(testlib.TestCase): @@ -89,14 +87,14 @@ class PkgutilMethodTest(testlib.TestCase): def test_empty_source_pkg(self): path, src, is_pkg = self.call('module_finder_testmod') self.assertEquals(path, - os.path.join(MODS_PATH, 'module_finder_testmod/__init__.py')) + os.path.join(MODS_DIR, 'module_finder_testmod/__init__.py')) self.assertEquals(mitogen.core.b(''), src) self.assertTrue(is_pkg) def test_empty_source_module(self): path, src, is_pkg = self.call('module_finder_testmod.empty_mod') self.assertEquals(path, - os.path.join(MODS_PATH, 'module_finder_testmod/empty_mod.py')) + os.path.join(MODS_DIR, 'module_finder_testmod/empty_mod.py')) self.assertEquals(mitogen.core.b(''), src) self.assertFalse(is_pkg) @@ -104,7 +102,7 @@ class PkgutilMethodTest(testlib.TestCase): from module_finder_testmod import regular_mod path, src, is_pkg = self.call('module_finder_testmod.regular_mod') self.assertEquals(path, - os.path.join(MODS_PATH, 'module_finder_testmod/regular_mod.py')) + os.path.join(MODS_DIR, 'module_finder_testmod/regular_mod.py')) self.assertEquals(mitogen.core.to_text(src), inspect.getsource(regular_mod)) self.assertFalse(is_pkg) @@ -166,7 +164,7 @@ class GetModuleViaParentEnumerationTest(testlib.TestCase): # plumbum has been eating too many rainbow-colored pills import pkg_like_plumbum.colors path, src, is_pkg = self.call('pkg_like_plumbum.colors') - modpath = os.path.join(MODS_PATH, 'pkg_like_plumbum/colors.py') + modpath = os.path.join(MODS_DIR, 'pkg_like_plumbum/colors.py') self.assertEquals(path, modpath) self.assertEquals(src, open(modpath, 'rb').read()) @@ -182,7 +180,7 @@ class GetModuleViaParentEnumerationTest(testlib.TestCase): ) path, src, is_pkg = self.call('pkg_like_ansible.module_utils.distro') - modpath = os.path.join(MODS_PATH, + modpath = os.path.join(MODS_DIR, 'pkg_like_ansible/module_utils/distro/__init__.py') self.assertEquals(path, modpath) self.assertEquals(src, open(modpath, 'rb').read()) @@ -259,7 +257,7 @@ class FindRelatedTest(testlib.TestCase): if sys.version_info > (2, 6): class DjangoMixin(object): - WEBPROJECT_PATH = os.path.join(MODS_PATH, 'webproject') + WEBPROJECT_PATH = os.path.join(MODS_DIR, 'webproject') # TODO: rip out Django and replace with a static tree of weird imports # that don't depend on .. Django! The hack below is because the version diff --git a/tests/testlib.py b/tests/testlib.py index 2ee672be..04a48d84 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -41,6 +41,11 @@ except NameError: LOG = logging.getLogger(__name__) DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') +MODS_DIR = os.path.join(DATA_DIR, 'importer') + +sys.path.append(DATA_DIR) +sys.path.append(MODS_DIR) + if mitogen.is_master: mitogen.utils.log_to_file()