Skip to content

Commit

Permalink
Moved tests out of the application package.
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed Jun 3, 2015
1 parent bf17508 commit 90cdd6f
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 13 deletions.
1 change: 0 additions & 1 deletion .coveragerc
@@ -1,4 +1,3 @@
[run]
source = polymodels
branch = True
omit = polymodels/*tests*
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -18,7 +18,7 @@
install_requires=(
'django>=1.4',
),
packages=find_packages(),
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
license='MIT License',
classifiers=[
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion polymodels/tests/forms.py → tests/forms.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals

from ..forms import PolymorphicModelForm
from polymodels.forms import PolymorphicModelForm

from .models import Animal, BigSnake, Snake


Expand Down
4 changes: 2 additions & 2 deletions polymodels/tests/models.py → tests/models.py
Expand Up @@ -4,8 +4,8 @@

from django.db import models

from ..fields import PolymorphicTypeField
from ..models import PolymorphicModel
from polymodels.fields import PolymorphicTypeField
from polymodels.models import PolymorphicModel


class Zoo(models.Model):
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions polymodels/tests/test_fields.py → tests/test_fields.py
Expand Up @@ -5,8 +5,9 @@
from django.db import models
from django.db.models.query_utils import Q

from ..compat import get_content_type, get_remote_field, skipUnless
from ..fields import PolymorphicTypeField
from polymodels.compat import get_content_type, get_remote_field, skipUnless
from polymodels.fields import PolymorphicTypeField

from .base import TestCase
from .models import AcknowledgedTrait, HugeSnake, Snake, Trait

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion polymodels/tests/test_managers.py → tests/test_managers.py
Expand Up @@ -4,7 +4,8 @@
from django.core.exceptions import ImproperlyConfigured
from django.db import models

from ..managers import PolymorphicManager
from polymodels.managers import PolymorphicManager

from .base import TestCase
from .models import Animal, BigSnake, HugeSnake, Mammal, Monkey, Snake

Expand Down
9 changes: 5 additions & 4 deletions polymodels/tests/test_models.py → tests/test_models.py
Expand Up @@ -3,7 +3,8 @@
from django.core.exceptions import ImproperlyConfigured
from django.db import models

from ..models import BasePolymorphicModel
from polymodels.models import BasePolymorphicModel

from .base import TestCase
from .models import Animal, BigSnake, HugeSnake, Mammal, Snake

Expand All @@ -16,18 +17,18 @@ def test_improperly_configured(self):
class NoCtFieldModel(BasePolymorphicModel):
pass
with self.assertRaisesMessage(ImproperlyConfigured,
'`polymodels.tests.test_models.InexistentCtFieldModel.CONTENT_TYPE_FIELD` '
'`tests.test_models.InexistentCtFieldModel.CONTENT_TYPE_FIELD` '
'points to an inexistent field "inexistent_field".'):
class InexistentCtFieldModel(BasePolymorphicModel):
CONTENT_TYPE_FIELD = 'inexistent_field'
with self.assertRaisesMessage(ImproperlyConfigured,
'`polymodels.tests.test_models.InvalidCtFieldModel.a_char_field` '
'`tests.test_models.InvalidCtFieldModel.a_char_field` '
'must be a `ForeignKey` to `ContentType`.'):
class InvalidCtFieldModel(BasePolymorphicModel):
CONTENT_TYPE_FIELD = 'a_char_field'
a_char_field = models.CharField(max_length=255)
with self.assertRaisesMessage(ImproperlyConfigured,
'`polymodels.tests.test_models.InvalidCtFkFieldToModel.a_fk` '
'`tests.test_models.InvalidCtFkFieldToModel.a_fk` '
'must be a `ForeignKey` to `ContentType`.'):
class InvalidCtFkFieldToModel(BasePolymorphicModel):
CONTENT_TYPE_FIELD = 'a_fk'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -16,7 +16,7 @@ basepython =
py34: python3.4
usedevelop = true
commands =
{envpython} -R -Wonce {envbindir}/coverage run {envbindir}/django-admin.py test -v2 --settings=polymodels.tests.settings {posargs}
{envpython} -R -Wonce {envbindir}/coverage run {envbindir}/django-admin.py test -v2 --settings=tests.settings {posargs}
coverage report
deps =
coverage
Expand Down

0 comments on commit 90cdd6f

Please sign in to comment.