From 264f4479167bbe9db259a5c486d03fdf6aae6d6e Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Wed, 7 Sep 2016 08:48:13 +0300 Subject: [PATCH] Separate `tests` and `testproject` --- setup.cfg | 3 +-- {tests => testproject}/__init__.py | 0 {tests => testproject}/locale/en/LC_MESSAGES/.gitkeep | 0 {tests => testproject}/locale/fi/LC_MESSAGES/django.po | 0 {tests => testproject}/settings.py | 8 ++++---- {tests => testproject}/templates/test.txt | 0 {tests => testproject}/urls.py | 0 tests/babel.cfg | 2 +- tests/test_command.py | 8 +++----- tox.ini | 2 +- 10 files changed, 10 insertions(+), 13 deletions(-) rename {tests => testproject}/__init__.py (100%) rename {tests => testproject}/locale/en/LC_MESSAGES/.gitkeep (100%) rename {tests => testproject}/locale/fi/LC_MESSAGES/django.po (100%) rename {tests => testproject}/settings.py (79%) rename {tests => testproject}/templates/test.txt (100%) rename {tests => testproject}/urls.py (100%) diff --git a/setup.cfg b/setup.cfg index 6993de8..18e9ca2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,5 +2,4 @@ universal = 1 [tool:pytest] -DJANGO_SETTINGS_MODULE = tests.settings -norecursedirs = .git .tox .eggs .cache htmlcov venv* +DJANGO_SETTINGS_MODULE = testproject.settings diff --git a/tests/__init__.py b/testproject/__init__.py similarity index 100% rename from tests/__init__.py rename to testproject/__init__.py diff --git a/tests/locale/en/LC_MESSAGES/.gitkeep b/testproject/locale/en/LC_MESSAGES/.gitkeep similarity index 100% rename from tests/locale/en/LC_MESSAGES/.gitkeep rename to testproject/locale/en/LC_MESSAGES/.gitkeep diff --git a/tests/locale/fi/LC_MESSAGES/django.po b/testproject/locale/fi/LC_MESSAGES/django.po similarity index 100% rename from tests/locale/fi/LC_MESSAGES/django.po rename to testproject/locale/fi/LC_MESSAGES/django.po diff --git a/tests/settings.py b/testproject/settings.py similarity index 79% rename from tests/settings.py rename to testproject/settings.py index 38971b9..e3b46c8 100644 --- a/tests/settings.py +++ b/testproject/settings.py @@ -1,11 +1,11 @@ -import os +import pkg_resources SECRET_KEY = 'x' USE_I18N = True -ROOT_URLCONF = 'tests.urls' +ROOT_URLCONF = 'testproject.urls' INSTALLED_APPS = [ 'django_babel', - 'tests', + 'testproject', ] MIDDLEWARE_CLASSES = [ 'django.middleware.locale.LocaleMiddleware', @@ -24,5 +24,5 @@ TEMPLATES = [ }, ] LOCALE_PATHS = [ - os.path.join(os.path.dirname(__file__), 'locale'), + pkg_resources.resource_filename(__name__, 'locale'), ] diff --git a/tests/templates/test.txt b/testproject/templates/test.txt similarity index 100% rename from tests/templates/test.txt rename to testproject/templates/test.txt diff --git a/tests/urls.py b/testproject/urls.py similarity index 100% rename from tests/urls.py rename to testproject/urls.py diff --git a/tests/babel.cfg b/tests/babel.cfg index 3d87ef6..71fb876 100644 --- a/tests/babel.cfg +++ b/tests/babel.cfg @@ -1 +1 @@ -[django: templates/**.*] +[django: **/templates/**.*] diff --git a/tests/test_command.py b/tests/test_command.py index 5cc04df..8ee6107 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -1,11 +1,9 @@ import os +import pkg_resources from django.core.management import call_command -TEST_LOCALE_DIR = os.path.join( - os.path.dirname(__file__), - 'locale', -) +TEST_LOCALE_DIR = pkg_resources.resource_filename('testproject', 'locale') def test_babel_compilemessages(): @@ -25,7 +23,7 @@ def test_babel_makemessages(): 'babel', 'makemessages', '-l', 'en', - '-F', os.path.join(os.path.dirname(__file__), 'babel.cfg'), + '-F', pkg_resources.resource_filename(__name__, 'babel.cfg'), ) # See that the expected files get populated with the discovered message for path in [ diff --git a/tox.ini b/tox.ini index 03257de..8c45bdb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27,py34}-django{18,19,110,master}, py33-django18, lint, docs +envlist = {py27,py34,py35}-django{18,19,110,master}, py33-django18, lint, docs [testenv] deps =