heinzel #4
2
LICENSE
Normal file
2
LICENSE
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted.
|
||||||
29
README.rst
29
README.rst
@@ -1,19 +1,36 @@
|
|||||||
ABOUT
|
ABOUT
|
||||||
=====
|
=====
|
||||||
This is a helper to deploy django apps.
|
This is a helper to deploy reusable django apps
|
||||||
|
into a django project.
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS
|
REQUIREMENTS
|
||||||
============
|
============
|
||||||
See INSTALL.rst
|
- python >= 2.7
|
||||||
|
- Django
|
||||||
|
(will be pulled in by pip, if you haven't installed it already.
|
||||||
|
Probably this is why you are interested in this project)
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
============
|
============
|
||||||
See INSTALL.rst
|
``pip install .``
|
||||||
|
|
||||||
|
|
||||||
LICENCE
|
USAGE
|
||||||
|
=====
|
||||||
|
``django-deploy.py --help``
|
||||||
|
|
||||||
|
|
||||||
|
DEVELOPMENT
|
||||||
|
===========
|
||||||
|
For running the test suite, you will need tox
|
||||||
|
(or pytest and mock).
|
||||||
|
|
||||||
|
Running the test suite:
|
||||||
|
``tox``
|
||||||
|
|
||||||
|
|
||||||
|
LICENSE
|
||||||
=======
|
=======
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
See LICENSE
|
||||||
for any purpose with or without fee is hereby granted.
|
|
||||||
|
|||||||
28
setup.py
28
setup.py
@@ -1,12 +1,18 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from setuptools import Command
|
from setuptools import Command
|
||||||
|
|
||||||
|
|
||||||
|
def long_description():
|
||||||
|
path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
file = os.path.join(path, 'README.rst')
|
||||||
|
with open(file) as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
class MyCommand(Command):
|
class MyCommand(Command):
|
||||||
user_options = []
|
user_options = []
|
||||||
|
|
||||||
@@ -62,10 +68,22 @@ class CreatePythonEnvironment(MyCommand):
|
|||||||
setup(
|
setup(
|
||||||
name='django-deploy',
|
name='django-deploy',
|
||||||
version='0.2.dev0',
|
version='0.2.dev0',
|
||||||
description='Helper to deploy django apps.',
|
description='A helper to deploy reusable django apps into a django project.',
|
||||||
|
long_description=long_description(),
|
||||||
|
long_description_content_type='text/x-rst',
|
||||||
url='https://dev.heinzelwerk.de/git/python/django-deploy',
|
url='https://dev.heinzelwerk.de/git/python/django-deploy',
|
||||||
maintainer='Jens Kleineheismann',
|
author='Jens Kleineheismann',
|
||||||
maintainer_email='heinzel@farbemachtstark.de',
|
author_email='heinzel@farbemachtstark.de',
|
||||||
|
classifiers=[
|
||||||
|
'Development Status :: 3 - Alpha',
|
||||||
|
'Environment :: Console',
|
||||||
|
'Framework :: Django',
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'Intended Audience :: System Administrators',
|
||||||
|
'License :: Public Domain',
|
||||||
|
'Operating System :: OS Independent',
|
||||||
|
'Programming Language :: Python',
|
||||||
|
],
|
||||||
cmdclass={
|
cmdclass={
|
||||||
'python': CreatePythonEnvironment,
|
'python': CreatePythonEnvironment,
|
||||||
},
|
},
|
||||||
@@ -77,8 +95,8 @@ setup(
|
|||||||
'django-deploy.py = django_deploy:main',
|
'django-deploy.py = django_deploy:main',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
python_requires='>=2.7',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'django',
|
'django',
|
||||||
'mock',
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ class DjangoProjectTestCase(DjangoDeployTestCase):
|
|||||||
'django_deploy.tests.fake_app2',
|
'django_deploy.tests.fake_app2',
|
||||||
]
|
]
|
||||||
self.assert_installed_apps(project_dir, installed_apps)
|
self.assert_installed_apps(project_dir, installed_apps)
|
||||||
|
self.assert_urlpatterns(project_dir, [])
|
||||||
|
|
||||||
def test_install_nonexisting_app(self):
|
def test_install_nonexisting_app(self):
|
||||||
project_dir = self._tmp_dir
|
project_dir = self._tmp_dir
|
||||||
@@ -191,6 +192,12 @@ class DjangoProjectTestCase(DjangoDeployTestCase):
|
|||||||
]
|
]
|
||||||
self.assert_urlpatterns(project_dir, expected_urlpatterns)
|
self.assert_urlpatterns(project_dir, expected_urlpatterns)
|
||||||
|
|
||||||
|
installed_apps = [
|
||||||
|
'django_deploy.tests.fake_app1',
|
||||||
|
'django_deploy.tests.fake_app2',
|
||||||
|
]
|
||||||
|
self.assert_installed_apps(project_dir, installed_apps)
|
||||||
|
|
||||||
def test_mount_unmountable_app(self):
|
def test_mount_unmountable_app(self):
|
||||||
project_dir = self._tmp_dir
|
project_dir = self._tmp_dir
|
||||||
project = DjangoProject(project_dir)
|
project = DjangoProject(project_dir)
|
||||||
|
|||||||
@@ -78,12 +78,14 @@ class ProgramTestCase(DjangoDeployTestCase):
|
|||||||
exitval = self._program(argv=argv)
|
exitval = self._program(argv=argv)
|
||||||
self.assertEqual(os.EX_OK, exitval)
|
self.assertEqual(os.EX_OK, exitval)
|
||||||
|
|
||||||
|
# Similar code from test_api.test_install_apps
|
||||||
installed_apps = [
|
installed_apps = [
|
||||||
'django_deploy.tests.fake_app1',
|
'django_deploy.tests.fake_app1',
|
||||||
'django_deploy.tests.fake_app2',
|
'django_deploy.tests.fake_app2',
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assert_installed_apps(project_dir, installed_apps)
|
self.assert_installed_apps(project_dir, installed_apps)
|
||||||
|
self.assert_urlpatterns(project_dir, [])
|
||||||
|
|
||||||
def test_install_apps_with_error(self):
|
def test_install_apps_with_error(self):
|
||||||
project_dir = self._tmp_dir
|
project_dir = self._tmp_dir
|
||||||
@@ -116,11 +118,21 @@ class ProgramTestCase(DjangoDeployTestCase):
|
|||||||
exitval = self._program(argv=argv)
|
exitval = self._program(argv=argv)
|
||||||
self.assertEqual(os.EX_OK, exitval)
|
self.assertEqual(os.EX_OK, exitval)
|
||||||
|
|
||||||
urlpatterns = [
|
# Similar code from test_api.test_mount_apps
|
||||||
|
expected_urlpatterns = [
|
||||||
('URLResolver', '^app1/', 'django_deploy.tests.fake_app1.urls'),
|
('URLResolver', '^app1/', 'django_deploy.tests.fake_app1.urls'),
|
||||||
('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'),
|
('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'),
|
||||||
]
|
]
|
||||||
self.assert_urlpatterns(project_dir, urlpatterns)
|
|
||||||
|
self.assert_urlpatterns(project_dir, expected_urlpatterns)
|
||||||
|
|
||||||
|
# Similar code from test_api.test_mount_apps
|
||||||
|
installed_apps = [
|
||||||
|
'django_deploy.tests.fake_app1',
|
||||||
|
'django_deploy.tests.fake_app2',
|
||||||
|
]
|
||||||
|
|
||||||
|
self.assert_installed_apps(project_dir, installed_apps)
|
||||||
|
|
||||||
def test_mount_apps_with_errors(self):
|
def test_mount_apps_with_errors(self):
|
||||||
project_dir = self._tmp_dir
|
project_dir = self._tmp_dir
|
||||||
@@ -134,8 +146,10 @@ class ProgramTestCase(DjangoDeployTestCase):
|
|||||||
exitval = self._program(argv=argv)
|
exitval = self._program(argv=argv)
|
||||||
self.assertNotEqual(os.EX_OK, exitval)
|
self.assertNotEqual(os.EX_OK, exitval)
|
||||||
|
|
||||||
patterns = [
|
# Similar code from test_api.test_mount_apps
|
||||||
|
expected_urlpatterns = [
|
||||||
('URLResolver', '^app1/', 'django_deploy.tests.fake_app1.urls'),
|
('URLResolver', '^app1/', 'django_deploy.tests.fake_app1.urls'),
|
||||||
('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'),
|
('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'),
|
||||||
]
|
]
|
||||||
self.assert_urlpatterns(project_dir, patterns)
|
|
||||||
|
self.assert_urlpatterns(project_dir, expected_urlpatterns)
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
SECRET_KEY = 'test_settings'
|
|
||||||
INSTALLED_APPS = [
|
|
||||||
'django_deploy.tests.fake_app',
|
|
||||||
]
|
|
||||||
1
tox.ini
1
tox.ini
@@ -6,6 +6,7 @@ deps = coverage
|
|||||||
py2: pylint-django<2
|
py2: pylint-django<2
|
||||||
py3: pylint-django
|
py3: pylint-django
|
||||||
pytest
|
pytest
|
||||||
|
mock
|
||||||
commands = coverage run -m pytest
|
commands = coverage run -m pytest
|
||||||
coverage report --skip-covered --fail-under=98
|
coverage report --skip-covered --fail-under=98
|
||||||
pylint django_deploy
|
pylint django_deploy
|
||||||
|
|||||||
Reference in New Issue
Block a user