From 0458e9cab069b978813ea50e5acce224fddf2c1a Mon Sep 17 00:00:00 2001 From: "Mr. Senko" Date: Sun, 4 Mar 2018 23:24:54 +0200 Subject: [PATCH 1/2] Move tests under pylint_django. Fixes #129 --- .coveragerc | 4 +++- {test => pylint_django/tests}/__init__.py | 0 {test => pylint_django/tests}/input/__init__.py | 0 .../input/external_django_tables2_noerror_meta_class.py | 0 .../tests}/input/external_drf_noerror_serializer.py | 0 .../tests}/input/external_drf_noerror_serializer.rc | 0 .../tests}/input/external_psycopg2_noerror_postgres_fields.py | 0 .../tests}/input/external_psycopg2_noerror_postgres_fields.rc | 0 .../tests}/input/func_model_does_not_use_unicode_py33.py | 0 .../tests}/input/func_model_does_not_use_unicode_py33.txt | 0 .../tests}/input/func_noerror_classviews.py | 0 .../input/func_noerror_duplicate_except_doesnotexist.py | 0 .../tests}/input/func_noerror_foreign_key_attributes.py | 0 .../tests}/input/func_noerror_foreign_key_ids.py | 0 .../tests}/input/func_noerror_foreign_key_sets.py | 0 .../tests}/input/func_noerror_foreignkeys.py | 0 .../tests}/input/func_noerror_form_fields.py | 0 .../tests}/input/func_noerror_forms_py33.py | 0 .../tests}/input/func_noerror_formview_ancestors.py | 0 .../tests}/input/func_noerror_ignore_meta_subclass.py | 0 {test => pylint_django/tests}/input/func_noerror_import_q.py | 0 {test => pylint_django/tests}/input/func_noerror_issue_46.py | 0 .../tests}/input/func_noerror_manytomanyfield.py | 0 .../tests}/input/func_noerror_model_fields.py | 0 .../tests}/input/func_noerror_model_methods.py | 0 .../tests}/input/func_noerror_model_unicode_callable.py | 0 .../tests}/input/func_noerror_model_unicode_lambda.py | 0 .../tests}/input/func_noerror_models_py33.py | 0 .../tests}/input/func_noerror_protected_meta_access.py | 0 .../tests}/input/func_noerror_ugettext_lazy_format.py | 0 .../tests}/input/func_noerror_unicode_py2_compatible.py | 0 {test => pylint_django/tests}/input/func_noerror_urls.py | 0 .../tests}/input/func_noerror_uuid_field.py | 0 {test => pylint_django/tests}/test_func.py | 3 +++ scripts/test.sh | 2 +- tox.ini | 2 +- 36 files changed, 8 insertions(+), 3 deletions(-) rename {test => pylint_django/tests}/__init__.py (100%) rename {test => pylint_django/tests}/input/__init__.py (100%) rename {test => pylint_django/tests}/input/external_django_tables2_noerror_meta_class.py (100%) rename {test => pylint_django/tests}/input/external_drf_noerror_serializer.py (100%) rename {test => pylint_django/tests}/input/external_drf_noerror_serializer.rc (100%) rename {test => pylint_django/tests}/input/external_psycopg2_noerror_postgres_fields.py (100%) rename {test => pylint_django/tests}/input/external_psycopg2_noerror_postgres_fields.rc (100%) rename {test => pylint_django/tests}/input/func_model_does_not_use_unicode_py33.py (100%) rename {test => pylint_django/tests}/input/func_model_does_not_use_unicode_py33.txt (100%) rename {test => pylint_django/tests}/input/func_noerror_classviews.py (100%) rename {test => pylint_django/tests}/input/func_noerror_duplicate_except_doesnotexist.py (100%) rename {test => pylint_django/tests}/input/func_noerror_foreign_key_attributes.py (100%) rename {test => pylint_django/tests}/input/func_noerror_foreign_key_ids.py (100%) rename {test => pylint_django/tests}/input/func_noerror_foreign_key_sets.py (100%) rename {test => pylint_django/tests}/input/func_noerror_foreignkeys.py (100%) rename {test => pylint_django/tests}/input/func_noerror_form_fields.py (100%) rename {test => pylint_django/tests}/input/func_noerror_forms_py33.py (100%) rename {test => pylint_django/tests}/input/func_noerror_formview_ancestors.py (100%) rename {test => pylint_django/tests}/input/func_noerror_ignore_meta_subclass.py (100%) rename {test => pylint_django/tests}/input/func_noerror_import_q.py (100%) rename {test => pylint_django/tests}/input/func_noerror_issue_46.py (100%) rename {test => pylint_django/tests}/input/func_noerror_manytomanyfield.py (100%) rename {test => pylint_django/tests}/input/func_noerror_model_fields.py (100%) rename {test => pylint_django/tests}/input/func_noerror_model_methods.py (100%) rename {test => pylint_django/tests}/input/func_noerror_model_unicode_callable.py (100%) rename {test => pylint_django/tests}/input/func_noerror_model_unicode_lambda.py (100%) rename {test => pylint_django/tests}/input/func_noerror_models_py33.py (100%) rename {test => pylint_django/tests}/input/func_noerror_protected_meta_access.py (100%) rename {test => pylint_django/tests}/input/func_noerror_ugettext_lazy_format.py (100%) rename {test => pylint_django/tests}/input/func_noerror_unicode_py2_compatible.py (100%) rename {test => pylint_django/tests}/input/func_noerror_urls.py (100%) rename {test => pylint_django/tests}/input/func_noerror_uuid_field.py (100%) rename {test => pylint_django/tests}/test_func.py (89%) diff --git a/.coveragerc b/.coveragerc index 6bbc560b..b2fdd994 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,5 @@ - [run] source=pylint_django + +[report] +omit=pylint_django/tests/* diff --git a/test/__init__.py b/pylint_django/tests/__init__.py similarity index 100% rename from test/__init__.py rename to pylint_django/tests/__init__.py diff --git a/test/input/__init__.py b/pylint_django/tests/input/__init__.py similarity index 100% rename from test/input/__init__.py rename to pylint_django/tests/input/__init__.py diff --git a/test/input/external_django_tables2_noerror_meta_class.py b/pylint_django/tests/input/external_django_tables2_noerror_meta_class.py similarity index 100% rename from test/input/external_django_tables2_noerror_meta_class.py rename to pylint_django/tests/input/external_django_tables2_noerror_meta_class.py diff --git a/test/input/external_drf_noerror_serializer.py b/pylint_django/tests/input/external_drf_noerror_serializer.py similarity index 100% rename from test/input/external_drf_noerror_serializer.py rename to pylint_django/tests/input/external_drf_noerror_serializer.py diff --git a/test/input/external_drf_noerror_serializer.rc b/pylint_django/tests/input/external_drf_noerror_serializer.rc similarity index 100% rename from test/input/external_drf_noerror_serializer.rc rename to pylint_django/tests/input/external_drf_noerror_serializer.rc diff --git a/test/input/external_psycopg2_noerror_postgres_fields.py b/pylint_django/tests/input/external_psycopg2_noerror_postgres_fields.py similarity index 100% rename from test/input/external_psycopg2_noerror_postgres_fields.py rename to pylint_django/tests/input/external_psycopg2_noerror_postgres_fields.py diff --git a/test/input/external_psycopg2_noerror_postgres_fields.rc b/pylint_django/tests/input/external_psycopg2_noerror_postgres_fields.rc similarity index 100% rename from test/input/external_psycopg2_noerror_postgres_fields.rc rename to pylint_django/tests/input/external_psycopg2_noerror_postgres_fields.rc diff --git a/test/input/func_model_does_not_use_unicode_py33.py b/pylint_django/tests/input/func_model_does_not_use_unicode_py33.py similarity index 100% rename from test/input/func_model_does_not_use_unicode_py33.py rename to pylint_django/tests/input/func_model_does_not_use_unicode_py33.py diff --git a/test/input/func_model_does_not_use_unicode_py33.txt b/pylint_django/tests/input/func_model_does_not_use_unicode_py33.txt similarity index 100% rename from test/input/func_model_does_not_use_unicode_py33.txt rename to pylint_django/tests/input/func_model_does_not_use_unicode_py33.txt diff --git a/test/input/func_noerror_classviews.py b/pylint_django/tests/input/func_noerror_classviews.py similarity index 100% rename from test/input/func_noerror_classviews.py rename to pylint_django/tests/input/func_noerror_classviews.py diff --git a/test/input/func_noerror_duplicate_except_doesnotexist.py b/pylint_django/tests/input/func_noerror_duplicate_except_doesnotexist.py similarity index 100% rename from test/input/func_noerror_duplicate_except_doesnotexist.py rename to pylint_django/tests/input/func_noerror_duplicate_except_doesnotexist.py diff --git a/test/input/func_noerror_foreign_key_attributes.py b/pylint_django/tests/input/func_noerror_foreign_key_attributes.py similarity index 100% rename from test/input/func_noerror_foreign_key_attributes.py rename to pylint_django/tests/input/func_noerror_foreign_key_attributes.py diff --git a/test/input/func_noerror_foreign_key_ids.py b/pylint_django/tests/input/func_noerror_foreign_key_ids.py similarity index 100% rename from test/input/func_noerror_foreign_key_ids.py rename to pylint_django/tests/input/func_noerror_foreign_key_ids.py diff --git a/test/input/func_noerror_foreign_key_sets.py b/pylint_django/tests/input/func_noerror_foreign_key_sets.py similarity index 100% rename from test/input/func_noerror_foreign_key_sets.py rename to pylint_django/tests/input/func_noerror_foreign_key_sets.py diff --git a/test/input/func_noerror_foreignkeys.py b/pylint_django/tests/input/func_noerror_foreignkeys.py similarity index 100% rename from test/input/func_noerror_foreignkeys.py rename to pylint_django/tests/input/func_noerror_foreignkeys.py diff --git a/test/input/func_noerror_form_fields.py b/pylint_django/tests/input/func_noerror_form_fields.py similarity index 100% rename from test/input/func_noerror_form_fields.py rename to pylint_django/tests/input/func_noerror_form_fields.py diff --git a/test/input/func_noerror_forms_py33.py b/pylint_django/tests/input/func_noerror_forms_py33.py similarity index 100% rename from test/input/func_noerror_forms_py33.py rename to pylint_django/tests/input/func_noerror_forms_py33.py diff --git a/test/input/func_noerror_formview_ancestors.py b/pylint_django/tests/input/func_noerror_formview_ancestors.py similarity index 100% rename from test/input/func_noerror_formview_ancestors.py rename to pylint_django/tests/input/func_noerror_formview_ancestors.py diff --git a/test/input/func_noerror_ignore_meta_subclass.py b/pylint_django/tests/input/func_noerror_ignore_meta_subclass.py similarity index 100% rename from test/input/func_noerror_ignore_meta_subclass.py rename to pylint_django/tests/input/func_noerror_ignore_meta_subclass.py diff --git a/test/input/func_noerror_import_q.py b/pylint_django/tests/input/func_noerror_import_q.py similarity index 100% rename from test/input/func_noerror_import_q.py rename to pylint_django/tests/input/func_noerror_import_q.py diff --git a/test/input/func_noerror_issue_46.py b/pylint_django/tests/input/func_noerror_issue_46.py similarity index 100% rename from test/input/func_noerror_issue_46.py rename to pylint_django/tests/input/func_noerror_issue_46.py diff --git a/test/input/func_noerror_manytomanyfield.py b/pylint_django/tests/input/func_noerror_manytomanyfield.py similarity index 100% rename from test/input/func_noerror_manytomanyfield.py rename to pylint_django/tests/input/func_noerror_manytomanyfield.py diff --git a/test/input/func_noerror_model_fields.py b/pylint_django/tests/input/func_noerror_model_fields.py similarity index 100% rename from test/input/func_noerror_model_fields.py rename to pylint_django/tests/input/func_noerror_model_fields.py diff --git a/test/input/func_noerror_model_methods.py b/pylint_django/tests/input/func_noerror_model_methods.py similarity index 100% rename from test/input/func_noerror_model_methods.py rename to pylint_django/tests/input/func_noerror_model_methods.py diff --git a/test/input/func_noerror_model_unicode_callable.py b/pylint_django/tests/input/func_noerror_model_unicode_callable.py similarity index 100% rename from test/input/func_noerror_model_unicode_callable.py rename to pylint_django/tests/input/func_noerror_model_unicode_callable.py diff --git a/test/input/func_noerror_model_unicode_lambda.py b/pylint_django/tests/input/func_noerror_model_unicode_lambda.py similarity index 100% rename from test/input/func_noerror_model_unicode_lambda.py rename to pylint_django/tests/input/func_noerror_model_unicode_lambda.py diff --git a/test/input/func_noerror_models_py33.py b/pylint_django/tests/input/func_noerror_models_py33.py similarity index 100% rename from test/input/func_noerror_models_py33.py rename to pylint_django/tests/input/func_noerror_models_py33.py diff --git a/test/input/func_noerror_protected_meta_access.py b/pylint_django/tests/input/func_noerror_protected_meta_access.py similarity index 100% rename from test/input/func_noerror_protected_meta_access.py rename to pylint_django/tests/input/func_noerror_protected_meta_access.py diff --git a/test/input/func_noerror_ugettext_lazy_format.py b/pylint_django/tests/input/func_noerror_ugettext_lazy_format.py similarity index 100% rename from test/input/func_noerror_ugettext_lazy_format.py rename to pylint_django/tests/input/func_noerror_ugettext_lazy_format.py diff --git a/test/input/func_noerror_unicode_py2_compatible.py b/pylint_django/tests/input/func_noerror_unicode_py2_compatible.py similarity index 100% rename from test/input/func_noerror_unicode_py2_compatible.py rename to pylint_django/tests/input/func_noerror_unicode_py2_compatible.py diff --git a/test/input/func_noerror_urls.py b/pylint_django/tests/input/func_noerror_urls.py similarity index 100% rename from test/input/func_noerror_urls.py rename to pylint_django/tests/input/func_noerror_urls.py diff --git a/test/input/func_noerror_uuid_field.py b/pylint_django/tests/input/func_noerror_uuid_field.py similarity index 100% rename from test/input/func_noerror_uuid_field.py rename to pylint_django/tests/input/func_noerror_uuid_field.py diff --git a/test/test_func.py b/pylint_django/tests/test_func.py similarity index 89% rename from test/test_func.py rename to pylint_django/tests/test_func.py index b6fd2745..e712ee2d 100644 --- a/test/test_func.py +++ b/pylint_django/tests/test_func.py @@ -8,6 +8,9 @@ sys.path.append(os.path.join(os.path.dirname(pylint.__file__), 'test')) import test_functional +# alter sys.path again because the tests now live as a subdirectory +# of pylint_django +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) from pylint_django.compat import django_version diff --git a/scripts/test.sh b/scripts/test.sh index 32d97261..9f734e67 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,2 +1,2 @@ #!/bin/bash -PYTHONPATH=. python test/test_func.py +python pylint_django/tests/test_func.py diff --git a/tox.ini b/tox.ini index 5f4cbe54..3f374773 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ commands = flake8: flake8 pylint: pylint --rcfile=tox.ini pylint_django setup readme: python setup.py check --restructuredtext --strict - py{27,34,35,36}-django{111,20}: coverage run test/test_func.py + py{27,34,35,36}-django{111,20}: coverage run pylint_django/tests/test_func.py clean: find . -type f -name '*.pyc' -delete clean: find . -type d -name __pycache__ -delete clean: rm -rf build/ .cache/ dist/ .eggs/ pylint_django.egg-info/ .tox/ From 98e5091a04859ea65bfa06f3166af3b2951f5fb5 Mon Sep 17 00:00:00 2001 From: "Mr. Senko" Date: Sun, 4 Mar 2018 23:26:37 +0200 Subject: [PATCH 2/2] Update MANIFEST.in and setup.py - setup.py: move all the values directly as parameters to setup() to make it more readable and avoid scrolling back and forth to figure out what comes from where - MANIFEST.in: add Markdown files to the list of included files, e.g. CHANGELOG, CONTRIBUTORS, README; adjust how we include the supplementary files for tests --- MANIFEST.in | 5 +++-- setup.py | 56 ++++++++++++++++------------------------------------- 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 430cc020..3bfb0025 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +include *.md include LICENSE -include pylint_django/transforms/transforms/* -include test/input/*.txt test/input/*.rc +include pylint_django/transforms/transforms/*.py +recursive-include pylint_django/tests/ *.py *.rc *.txt diff --git a/setup.py b/setup.py index f0424b65..abc1b834 100644 --- a/setup.py +++ b/setup.py @@ -5,52 +5,30 @@ import os from setuptools import setup, find_packages -VERSION = '0.9.1' -PACKAGES = find_packages(exclude=[ - '*.tests', - '*.tests.*', - 'tests.*', - 'tests', -]) - -SHORT_DESCRIPTION = 'A Pylint plugin to help Pylint understand the Django web framework' - -TRANSFORM_DIR = 'pylint_django/transforms/transforms' -PACKAGE_DATA = { - 'pylint_django': [ - os.path.join('transforms/transforms', name) for name in os.listdir(TRANSFORM_DIR) - ] -} - -CLASSIFIERS = ( - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Operating System :: Unix', - 'Topic :: Software Development :: Quality Assurance', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', -) - -INSTALL_REQUIRES = [ - 'pylint-plugin-utils>=0.2.1', - 'pylint>=1.8.2', -] - setup( name='pylint-django', url='https://github.com/PyCQA/pylint-django', author='landscape.io', author_email='code@landscape.io', - description=SHORT_DESCRIPTION, - version=VERSION, - packages=PACKAGES, - package_data=PACKAGE_DATA, - install_requires=INSTALL_REQUIRES, + description='A Pylint plugin to help Pylint understand the Django web framework', + version='0.9.2', + packages=find_packages(), + install_requires=[ + 'pylint-plugin-utils>=0.2.1', + 'pylint>=1.8.2', + ], license='GPLv2', - classifiers=CLASSIFIERS, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Operating System :: Unix', + 'Topic :: Software Development :: Quality Assurance', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ], keywords=['pylint', 'django', 'plugin'], zip_safe=False, )