Ticket #14087: zip_egg_fixed.4.diff
File zip_egg_fixed.4.diff, 22.3 KB (added by , 13 years ago) |
---|
-
django/core/management/__init__.py
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 8e83304..74bb558 100644
a b import os 3 3 import sys 4 4 from optparse import OptionParser, NO_DEFAULT 5 5 import imp 6 import pkgutil 6 7 import warnings 7 8 8 9 from django.core.management.base import BaseCommand, CommandError, handle_default_options 9 10 from django.core.management.color import color_style 10 from django.utils.importlib import import_module 11 from django.utils.importlib import import_module, find_package_path 11 12 12 13 # For backwards compatibility: get_version() used to be in this module. 13 14 from django import get_version … … def find_commands(management_dir): 23 24 24 25 Returns an empty list if no commands are defined. 25 26 """ 26 command_dir = os.path.join(management_dir, 'commands')27 27 try: 28 return [f[:-3] for f in os.listdir(command_dir) 29 if not f.startswith('_') and f.endswith('.py')] 30 except OSError: 28 commands_dir = find_package_path('commands', [management_dir])[0] 29 return [name for loader,name,ispkg in pkgutil.iter_modules([commands_dir]) 30 if not name.startswith('_') ] 31 except ImportError: 31 32 return [] 32 33 33 34 def find_management_module(app_name): … … def find_management_module(app_name): 39 40 """ 40 41 parts = app_name.split('.') 41 42 parts.append('management') 42 parts.reverse() 43 part = parts.pop() 44 path = None 45 46 # When using manage.py, the project module is added to the path, 47 # loaded, then removed from the path. This means that 48 # testproject.testapp.models can be loaded in future, even if 49 # testproject isn't in the path. When looking for the management 50 # module, we need look for the case where the project name is part 51 # of the app_name but the project directory itself isn't on the path. 52 try: 53 f, path, descr = imp.find_module(part,path) 54 except ImportError,e: 55 if os.path.basename(os.getcwd()) != part: 56 raise e 43 44 for i in range(len(parts), 0, -1): 45 try: 46 path = sys.modules['.'.join(parts[:i])].__path__ 47 except AttributeError: 48 raise ImportError("No package named %s" % parts[i-1]) 49 except KeyError: 50 continue 51 52 parts = parts[i:] 53 parts.reverse() 54 break 55 else: 56 parts.reverse() 57 part = parts.pop() 58 path = None 59 60 # When using manage.py, the project module is added to the path, 61 # loaded, then removed from the path. This means that 62 # testproject.testapp.models can be loaded in future, even if 63 # testproject isn't in the path. When looking for the management 64 # module, we need look for the case where the project name is part 65 # of the app_name but the project directory itself isn't on the path. 66 try: 67 path = find_package_path(part, path) 68 except ImportError,e: 69 if os.path.basename(os.getcwd()) != part: 70 raise e 57 71 58 72 while parts: 59 73 part = parts.pop() 60 f, path, descr = imp.find_module(part, path and [path] or None)61 return path 74 path = find_package_path(part, path) 75 return path[0] 62 76 63 77 def load_command_class(app_name, name): 64 78 """ -
django/utils/importlib.py
diff --git a/django/utils/importlib.py b/django/utils/importlib.py index ef4d0e4..f53abd9 100644
a b 1 1 # Taken from Python 2.7 with permission from/by the original author. 2 import os 2 3 import sys 4 import imp 5 import pkgutil 6 import warnings 3 7 4 8 def _resolve_name(name, package, level): 5 9 """Return the absolute name of the module to be imported.""" … … def import_module(name, package=None): 34 38 name = _resolve_name(name[level:], package, level) 35 39 __import__(name) 36 40 return sys.modules[name] 41 42 43 def find_package_path(name, path=None): 44 """Finds search path for package with given name. 45 46 The 'path' argument defaults to ``sys.path``. 47 48 Raises ImportError if no search path could be found. 49 """ 50 if path is None: 51 path = sys.path 52 53 results = [] 54 55 for path_item in path: 56 importer = get_importer(path_item) 57 58 if importer is None: 59 continue 60 61 try: 62 loader = importer.find_module(name) 63 64 if loader is not None: 65 66 if not hasattr(loader, 'is_package'): 67 warnings.warn( 68 "Django cannot find search path for package '%s' ", 69 "under '%s', because the loader returned by '%s' does ", 70 "not implement 'is_package' method."%( 71 name, 72 path_item, 73 importer.__class__.__name__)) 74 continue 75 76 if not hasattr(loader, 'get_filename'): 77 warnings.warn( 78 "Django cannot find search path for package '%s' ", 79 "under '%s', because the loader returned by '%s' does ", 80 "not implement 'get_filename' method."%( 81 name, 82 path_item, 83 importer.__class__.__name__)) 84 continue 85 86 if loader.is_package(name): 87 results.append(os.path.dirname(loader.get_filename(name))) 88 except ImportError: 89 pass 90 91 if not results: 92 raise ImportError("No package named %s" % name) 93 94 return results 95 96 97 get_importer = pkgutil.get_importer 98 99 try: 100 import zipimport 101 102 if hasattr(zipimport.zipimporter, 'get_filename'): 103 class ZipImporter(zipimport.zipimporter): 104 def get_filename(self, fullname): 105 archivepath = os.path.join(self.archive, self.prefix) 106 if self.is_package(fullname): 107 return os.path.join(archivepath, fullname, '__init__.py') 108 109 return os.path.join(archivepath, fullname + '.py') 110 111 def get_importer(path_item): 112 importer = pkgutil.get_importer(path_item) 113 114 if isinstance(importer, zipimport.zipimporter): 115 archivepath = os.path.join(importer.archive, importer.prefix) 116 importer = ZipImporter(os.path.dirname(archivepath)) 117 118 return importer 119 120 except ImportError: 121 pass 122 123 -
new file tests/regressiontests/admin_scripts/lib1/nons_app/management/commands/nons_app_command1.py
diff --git a/tests/regressiontests/admin_scripts/lib1/nons_app/__init__.py b/tests/regressiontests/admin_scripts/lib1/nons_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nons_app/management/__init__.py b/tests/regressiontests/admin_scripts/lib1/nons_app/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nons_app/management/commands/__init__.py b/tests/regressiontests/admin_scripts/lib1/nons_app/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nons_app/management/commands/nons_app_command1.py b/tests/regressiontests/admin_scripts/lib1/nons_app/management/commands/nons_app_command1.py new file mode 100644 index 0000000..a393663
- + 1 from django.core.management.base import BaseCommand 2 3 class Command(BaseCommand): 4 help = 'Test managment commands in non-namespaced app' 5 requires_model_validation = False 6 args = '' 7 8 def handle(self, *labels, **options): 9 print 'EXECUTE:nons_app_command1' -
new file tests/regressiontests/admin_scripts/lib1/nsapps/__init__.py
diff --git a/tests/regressiontests/admin_scripts/lib1/nons_app/models.py b/tests/regressiontests/admin_scripts/lib1/nons_app/models.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/npapp/__init__.py b/tests/regressiontests/admin_scripts/lib1/npapp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/npapp/management.py b/tests/regressiontests/admin_scripts/lib1/npapp/management.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/npapp/models.py b/tests/regressiontests/admin_scripts/lib1/npapp/models.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/__init__.py b/tests/regressiontests/admin_scripts/lib1/nsapps/__init__.py new file mode 100644 index 0000000..32f26d8
- + 1 # http://packages.python.org/distribute/setuptools.html#namespace-packages 2 try: 3 __import__('pkg_resources').declare_namespace(__name__) 4 except ImportError: 5 from pkgutil import extend_path 6 __path__ = extend_path(__path__, __name__) -
new file tests/regressiontests/admin_scripts/lib1/nsapps/contrib/__init__.py
diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/__init__.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/__init__.py new file mode 100644 index 0000000..32f26d8
- + 1 # http://packages.python.org/distribute/setuptools.html#namespace-packages 2 try: 3 __import__('pkg_resources').declare_namespace(__name__) 4 except ImportError: 5 from pkgutil import extend_path 6 __path__ = extend_path(__path__, __name__) -
new file tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/commands/app1_command1.py
diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/__init__.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/__init__.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/commands/__init__.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/commands/app1_command1.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/management/commands/app1_command1.py new file mode 100644 index 0000000..2f479bb
- + 1 from django.core.management.base import BaseCommand 2 3 class Command(BaseCommand): 4 help = 'Test managment commands in namespaced apps' 5 requires_model_validation = False 6 args = '' 7 8 def handle(self, *labels, **options): 9 print 'EXECUTE:app1_command1' -
new file tests/regressiontests/admin_scripts/lib2/nsapps/__init__.py
diff --git a/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/models.py b/tests/regressiontests/admin_scripts/lib1/nsapps/contrib/app1/models.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/__init__.py b/tests/regressiontests/admin_scripts/lib2/nsapps/__init__.py new file mode 100644 index 0000000..32f26d8
- + 1 # http://packages.python.org/distribute/setuptools.html#namespace-packages 2 try: 3 __import__('pkg_resources').declare_namespace(__name__) 4 except ImportError: 5 from pkgutil import extend_path 6 __path__ = extend_path(__path__, __name__) -
new file tests/regressiontests/admin_scripts/lib2/nsapps/contrib/__init__.py
diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/__init__.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/__init__.py new file mode 100644 index 0000000..32f26d8
- + 1 # http://packages.python.org/distribute/setuptools.html#namespace-packages 2 try: 3 __import__('pkg_resources').declare_namespace(__name__) 4 except ImportError: 5 from pkgutil import extend_path 6 __path__ = extend_path(__path__, __name__) -
new file tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/commands/app2_command1.py
diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/__init__.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/__init__.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/commands/__init__.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/commands/app2_command1.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/management/commands/app2_command1.py new file mode 100644 index 0000000..b9e20a7
- + 1 from django.core.management.base import BaseCommand 2 3 class Command(BaseCommand): 4 help = 'Test managment commands in namespaced apps' 5 requires_model_validation = False 6 args = '' 7 8 def handle(self, *labels, **options): 9 print 'EXECUTE:app2_command1' -
new file tests/regressiontests/admin_scripts/lib3/_addsitedir.py
diff --git a/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/models.py b/tests/regressiontests/admin_scripts/lib2/nsapps/contrib/app2/models.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib3/_addsitedir.py b/tests/regressiontests/admin_scripts/lib3/_addsitedir.py new file mode 100644 index 0000000..9e264d2
- + 1 import os.path, site; site.addsitedir(os.path.dirname(__file__)) -
new file tests/regressiontests/admin_scripts/lib3/egg_module.pth
diff --git a/tests/regressiontests/admin_scripts/lib3/egg_module.pth b/tests/regressiontests/admin_scripts/lib3/egg_module.pth new file mode 100644 index 0000000..9367ab5
- + 1 test_egg.egg -
new file tests/regressiontests/admin_scripts/lib3/exapps-nspkg.pth
diff --git a/tests/regressiontests/admin_scripts/lib3/exapps-nspkg.pth b/tests/regressiontests/admin_scripts/lib3/exapps-nspkg.pth new file mode 100644 index 0000000..1f31155
- + 1 import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('exapps',)); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault('exapps',new.module('exapps')); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p) -
new file tests/regressiontests/admin_scripts/lib3/exapps/app3/management/commands/app3_command1.py
diff --git a/tests/regressiontests/admin_scripts/lib3/exapps/app3/__init__.py b/tests/regressiontests/admin_scripts/lib3/exapps/app3/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/__init__.py b/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/commands/__init__.py b/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/commands/app3_command1.py b/tests/regressiontests/admin_scripts/lib3/exapps/app3/management/commands/app3_command1.py new file mode 100644 index 0000000..97f5d33
- + 1 from django.core.management.base import BaseCommand 2 3 class Command(BaseCommand): 4 help = 'Test managment commands in namespaced apps' 5 requires_model_validation = False 6 args = '' 7 8 def handle(self, *labels, **options): 9 print 'EXECUTE:app3_command1' -
new file tests/regressiontests/admin_scripts/lib3/exapps/app3/models.py
diff --git a/tests/regressiontests/admin_scripts/lib3/exapps/app3/models.py b/tests/regressiontests/admin_scripts/lib3/exapps/app3/models.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/regressiontests/admin_scripts/lib3/test_egg.egg b/tests/regressiontests/admin_scripts/lib3/test_egg.egg new file mode 100644 index 0000000000000000000000000000000000000000..d9e57de006a3d602515293f8e980bf3a16fb42c0 GIT binary patch literal 2210 zcmWIWW@Zs#W&na+g#z{<8U{Fl3|Dt|T~9wZfBgWcG7g3{KxHDAuKle5O78$-K~!ZB z^|5C+avd@dV0&QeKT+IcWwzNt$AHBOuWGiW^E|0~S|nLhZ9Ow6Z`b?h&-X7l#KHBh zGf2q)-n(7*SQNg9C6^pYKAZ6`^S*BSyQv&cUcXhIbLgw+nTectc?6~3uC9yNw%@sF z%ItZU8-gRR@<p(DZr01@&6oUg*2%XH)tT;p3*R&VooCL-z#xL`%wYe}AZOQLy^@NO zseK1QE_HeT&--$}fT-Y_2pj#SlFkL2Ia9R1z3&YW$hEDwHMjD;fuxnn<YS_977M&R zu%dHMh3c<Wrx~B0zcgk0r=s4kFE_0Ic06}8$L(iDarse;`D34maV9DL^?37iT78$4 zu;IH0CoB42FDd2_n0t1<bS;nS%|HFW4h3s`69&1M3mpESfSt^C-3aJd1`w7-c5zB- zL26z~YF=_>d`@Owb}`85T&Q|ip0Nz)2I>J}F=V|Z`33Pgsb#4-AWf<1>G8SwDWy57 zXxfpjMv2p^%mUrw#59O{NK!eBmQ+AiA`Av67Koo#6`-amkh_o+#>Z#oWtPOp>lIYO zVvd0U-EcHLxrup+>8ZJ?c_m2p+{#0>M-kN?Bt1k~DUVZoa(*t*u#{pvc54yVjKvWg z3_F2gHQm(j`*xsy9$*5{C2S5TD4{L_2BB}CcONJzf46gee`Y}-UxUeP$C<(gLc3RV zY9Cwi_n@qWz2AwZxYCuY=4Gw2oV2^}(@yDPS8>aY?k=--b8BlHne^Ic|6BWKH)7Jy zXsq#?eWx}ep56KFx(QD9DgGB`hCMj6_@itPSErDB#zVor9U@z^*FXBlA!>Exjl$u{ zsuuH{{dm6}Ulb7>vsbSqJM5*w#jS~~)~!DGw}|g^*kb!TX4*Er&D*q1x2SHj|9<>` zaDBt~!)B*vi6f<AwA2F1vq-50m~2yXiot1xkx7IZcc}%`1_S~P2OL2(QW*x*hP@O6 zDP~|$XxP%I4y2K^LCUlMZ&dB*r3+X$So=9-?MP(}#01>A9brNPF#h2Vz?S#XjY7}- z2&48O8--F7pqqhS0wB!zjcf+2JV1m8W}XEV2oL~@1#Kpjcto}rTLA&l2#SXgRE;Rv z1{N8ZmV*im2mo2$focX)QGo0YYy}9!43Ina;536sCxHqS2mm?hH%{Y_iWiXoAV~$? zZJ+`M0zhuF09GEznFLWh!VSafNbCg;!rTVJ=Asrq$icY=OHM`@-Nb_GWJJDZWdo_= P1Hv0X>$d>aF)#oC`tnrE
-
tests/regressiontests/admin_scripts/tests.py
literal 0 HcmV?d00001 diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index dd7e4b3..5d6d762 100644
a b class AdminScriptTestCase(unittest.TestCase): 90 90 def run_test(self, script, args, settings_file=None, apps=None): 91 91 project_dir = os.path.dirname(test_dir) 92 92 base_dir = os.path.dirname(project_dir) 93 lib1_dir = os.path.join(os.path.dirname(__file__), 'lib1') 94 lib2_dir = os.path.join(os.path.dirname(__file__), 'lib2') 95 lib3_dir = os.path.join(os.path.dirname(__file__), 'lib3') 96 eggs_dir = os.path.join(os.path.dirname(__file__), 'eggs') 93 97 ext_backend_base_dirs = self._ext_backend_paths() 94 98 95 99 # Remember the old environment … … class AdminScriptTestCase(unittest.TestCase): 107 111 os.environ['DJANGO_SETTINGS_MODULE'] = settings_file 108 112 elif 'DJANGO_SETTINGS_MODULE' in os.environ: 109 113 del os.environ['DJANGO_SETTINGS_MODULE'] 110 python_path = [project_dir, base_dir ]114 python_path = [project_dir, base_dir, lib1_dir, lib2_dir, lib3_dir] 111 115 python_path.extend(ext_backend_base_dirs) 112 116 os.environ[python_path_var_name] = os.pathsep.join(python_path) 113 117 … … class StartProject(LiveServerTestCase, AdminScriptTestCase): 1533 1537 with open(os.path.join(base_path, f)) as fh: 1534 1538 self.assertEqual(fh.read(), 1535 1539 '# some file for customtestproject test project') 1540 1541 class NamespacePackagedApps(AdminScriptTestCase): 1542 def setUp(self): 1543 self.write_settings('settings.py', apps=['nons_app', 'nsapps.contrib.app1','nsapps.contrib.app2','exapps.app3', 'egg_module']) 1544 settings_file = open(os.path.join(test_dir, 'settings.py'), 'a') 1545 settings_file.write('import _addsitedir') 1546 settings_file.close() 1547 1548 def tearDown(self): 1549 self.remove_settings('settings.py') 1550 1551 def test_help(self): 1552 out, err = self.run_manage(['help']) 1553 self.assertNoOutput(err) 1554 self.assertOutput(out, "nons_app_command1") 1555 self.assertOutput(out, "app1_command1") 1556 self.assertOutput(out, "app2_command1") 1557 self.assertOutput(out, "app3_command1") 1558 self.assertOutput(out, "egg_command") 1559 1560 def test_nons_app(self): 1561 args = ['nons_app_command1'] 1562 out, err = self.run_manage(args) 1563 self.assertNoOutput(err) 1564 self.assertOutput(out, "EXECUTE:nons_app_command1") 1565 1566 def test_nsapps(self): 1567 args = ['app1_command1'] 1568 out, err = self.run_manage(args) 1569 self.assertNoOutput(err) 1570 self.assertOutput(out, "EXECUTE:app1_command1") 1571 1572 args = ['app2_command1'] 1573 out, err = self.run_manage(args) 1574 self.assertNoOutput(err) 1575 self.assertOutput(out, "EXECUTE:app2_command1") 1576 1577 def test_exapps(self): 1578 args = ['app3_command1'] 1579 out, err = self.run_manage(args) 1580 self.assertNoOutput(err) 1581 self.assertOutput(out, "EXECUTE:app3_command1") 1582 1583 def test_exapps(self): 1584 args = ['egg_command'] 1585 out, err = self.run_manage(args) 1586 self.assertNoOutput(err) 1587 self.assertOutput(out, "EXECUTE:egg_command") 1588 1589 1590 class PreloadedNamespacePackagedApps(AdminScriptTestCase): 1591 def setUp(self): 1592 self.write_settings('settings.py', apps=['nsapps.contrib.app1','nsapps.contrib.app2']) 1593 settings_file = open(os.path.join(test_dir, 'settings.py'), 'a') 1594 settings_file.write('import nsapps') 1595 settings_file.close() 1596 1597 def tearDown(self): 1598 self.remove_settings('settings.py') 1599 1600 def test_help(self): 1601 out, err = self.run_manage(['help']) 1602 self.assertNoOutput(err) 1603 self.assertOutput(out, "app1_command1") 1604 self.assertOutput(out, "app2_command1") 1605 1606 def test_nsapps(self): 1607 args = ['app1_command1'] 1608 out, err = self.run_manage(args) 1609 self.assertNoOutput(err) 1610 self.assertOutput(out, "EXECUTE:app1_command1") 1611 1612 args = ['app2_command1'] 1613 out, err = self.run_manage(args) 1614 self.assertNoOutput(err) 1615 self.assertOutput(out, "EXECUTE:app2_command1") 1616 1617 1618 class NonPackageManagementApps(AdminScriptTestCase): 1619 def setUp(self): 1620 self.write_settings('settings.py', apps=['npapp']) 1621 settings_file = open(os.path.join(test_dir, 'settings.py'), 'a') 1622 settings_file.write('import npapp.management') 1623 settings_file.close() 1624 1625 def tearDown(self): 1626 self.remove_settings('settings.py') 1627 1628 def test_help(self): 1629 out, err = self.run_manage(['help']) 1630 self.assertNoOutput(err) 1631 1632