From cbfdb188b149155b0be651c33d00d483a36e94df Mon Sep 17 00:00:00 2001 From: heinzel Date: Sun, 17 Nov 2019 11:51:48 +0100 Subject: [PATCH 1/5] UPD: Improved Tests --- src/django_deploy/tests/test_api.py | 6 ++++++ src/django_deploy/tests/test_program.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/django_deploy/tests/test_api.py b/src/django_deploy/tests/test_api.py index 93c61bd..590a49a 100644 --- a/src/django_deploy/tests/test_api.py +++ b/src/django_deploy/tests/test_api.py @@ -143,6 +143,7 @@ class DjangoProjectTestCase(DjangoDeployTestCase): 'django_deploy.tests.fake_app2', ] self.assert_installed_apps(project_dir, installed_apps) + self.assert_urlpatterns(project_dir, []) def test_install_nonexisting_app(self): project_dir = self._tmp_dir @@ -190,6 +191,11 @@ class DjangoProjectTestCase(DjangoDeployTestCase): ('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'), ] 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): project_dir = self._tmp_dir diff --git a/src/django_deploy/tests/test_program.py b/src/django_deploy/tests/test_program.py index 687e7ab..d4277c3 100644 --- a/src/django_deploy/tests/test_program.py +++ b/src/django_deploy/tests/test_program.py @@ -82,8 +82,8 @@ class ProgramTestCase(DjangoDeployTestCase): 'django_deploy.tests.fake_app1', 'django_deploy.tests.fake_app2', ] - self.assert_installed_apps(project_dir, installed_apps) + self.assert_urlpatterns(project_dir, []) def test_install_apps_with_error(self): project_dir = self._tmp_dir @@ -122,6 +122,12 @@ class ProgramTestCase(DjangoDeployTestCase): ] self.assert_urlpatterns(project_dir, urlpatterns) + 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): project_dir = self._tmp_dir self._program(argv=['-c', project_dir]) From 10ce7a8869009bcc647f48cd9df8ad217b802bb8 Mon Sep 17 00:00:00 2001 From: heinzel Date: Sun, 17 Nov 2019 11:54:58 +0100 Subject: [PATCH 2/5] UPD: Removed useles __future__ import --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index bf1a062..f17ec90 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import unicode_literals import os import sys from setuptools import setup, find_packages From 5bcc4553a69dcfcaec7125984beaa11e41f72a48 Mon Sep 17 00:00:00 2001 From: heinzel Date: Sun, 17 Nov 2019 12:11:50 +0100 Subject: [PATCH 3/5] FIX: make pylint happy after modifying tests. --- src/django_deploy/tests/test_api.py | 1 + src/django_deploy/tests/test_program.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/django_deploy/tests/test_api.py b/src/django_deploy/tests/test_api.py index 590a49a..be184cf 100644 --- a/src/django_deploy/tests/test_api.py +++ b/src/django_deploy/tests/test_api.py @@ -191,6 +191,7 @@ class DjangoProjectTestCase(DjangoDeployTestCase): ('URLResolver', '^app2/', 'django_deploy.tests.fake_app2.urls'), ] self.assert_urlpatterns(project_dir, expected_urlpatterns) + installed_apps = [ 'django_deploy.tests.fake_app1', 'django_deploy.tests.fake_app2', diff --git a/src/django_deploy/tests/test_program.py b/src/django_deploy/tests/test_program.py index d4277c3..1bc03b5 100644 --- a/src/django_deploy/tests/test_program.py +++ b/src/django_deploy/tests/test_program.py @@ -78,10 +78,12 @@ class ProgramTestCase(DjangoDeployTestCase): exitval = self._program(argv=argv) self.assertEqual(os.EX_OK, exitval) + # Similar code from test_api.test_install_apps installed_apps = [ 'django_deploy.tests.fake_app1', 'django_deploy.tests.fake_app2', ] + self.assert_installed_apps(project_dir, installed_apps) self.assert_urlpatterns(project_dir, []) @@ -116,16 +118,20 @@ class ProgramTestCase(DjangoDeployTestCase): exitval = self._program(argv=argv) 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', '^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): @@ -140,8 +146,10 @@ class ProgramTestCase(DjangoDeployTestCase): exitval = self._program(argv=argv) 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', '^app2/', 'django_deploy.tests.fake_app2.urls'), ] - self.assert_urlpatterns(project_dir, patterns) + + self.assert_urlpatterns(project_dir, expected_urlpatterns) From 5179e832a4ee750960d427cf3e1c314151171f0e Mon Sep 17 00:00:00 2001 From: heinzel Date: Sun, 17 Nov 2019 12:15:49 +0100 Subject: [PATCH 4/5] UPD: removed an obsolete file --- src/django_deploy/tests/test_settings.py | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 src/django_deploy/tests/test_settings.py diff --git a/src/django_deploy/tests/test_settings.py b/src/django_deploy/tests/test_settings.py deleted file mode 100644 index 49dbf12..0000000 --- a/src/django_deploy/tests/test_settings.py +++ /dev/null @@ -1,4 +0,0 @@ -SECRET_KEY = 'test_settings' -INSTALLED_APPS = [ - 'django_deploy.tests.fake_app', -] From c4eff35ea5e0090b64d65eb6bbe36dc3456c6563 Mon Sep 17 00:00:00 2001 From: heinzel Date: Sun, 17 Nov 2019 14:01:09 +0100 Subject: [PATCH 5/5] UPD: Improved metadata and documentation. --- LICENSE | 2 ++ README.rst | 29 +++++++++++++++++++++++------ setup.py | 27 +++++++++++++++++++++++---- tox.ini | 1 + 4 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f76bc03 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted. diff --git a/README.rst b/README.rst index 889d05d..c1a5d2d 100644 --- a/README.rst +++ b/README.rst @@ -1,19 +1,36 @@ ABOUT ===== -This is a helper to deploy django apps. +This is a helper to deploy reusable django apps +into a django project. 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 ============ -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 -for any purpose with or without fee is hereby granted. +See LICENSE diff --git a/setup.py b/setup.py index f17ec90..14ddd0f 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,13 @@ from setuptools import setup, find_packages 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): user_options = [] @@ -61,10 +68,22 @@ class CreatePythonEnvironment(MyCommand): setup( name='django-deploy', 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', - maintainer='Jens Kleineheismann', - maintainer_email='heinzel@farbemachtstark.de', + author='Jens Kleineheismann', + 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={ 'python': CreatePythonEnvironment, }, @@ -76,8 +95,8 @@ setup( 'django-deploy.py = django_deploy:main', ], }, + python_requires='>=2.7', install_requires=[ 'django', - 'mock', ], ) diff --git a/tox.ini b/tox.ini index 90de704..6d7cb75 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ deps = coverage py2: pylint-django<2 py3: pylint-django pytest + mock commands = coverage run -m pytest coverage report --skip-covered --fail-under=98 pylint django_deploy