Giter Site home page Giter Site logo

django-pytest's People

Contributors

e98cuenc avatar jacob414 avatar redtoad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django-pytest's Issues

documentation: do Django TestCase instances work?

The readme shows an example of a test written as a function. But will tests defined as methods of a django.test.TestCase instance work as well? For those considering to migrate test suites this is an important question, and it should be included in the documentation.

No Verbose Param

I am using Django-Pytest and do not know if somehow you can set the Verbose parameter.

Thx.

If django-pytest is not installed `@pytest.mark.django_db` is ignored and the main database is used

I realise this is probably because pytest automatically generates these marks, and django-pytest uses them later, but it's quite...surprising to have your main database mutated by the tests :(

I have gotten around this by doing:

import django_pytest as _  # NOTE: Guarantees that pytest-django is installed.

Perhaps having an import alias in django_pytest might solve the problem? Something like:

from django_pytest import mark_django_db

Does not work with pytest>=2.0

Since version 2.0 pytest is its own package
http://pytest.org/changelog.html#changes-between-1-3-4-and-2-0-0

That means that the current load_entry_point mechanism is no longer working. With this small patch in test_runner.py it should work again:

try:
    entry_point = load_entry_point('py>=1.0.0', 'console_scripts', 'py.test')
except ImportError:
    entry_point = load_entry_point('pytest>=2.0', 'console_scripts', 'py.test')

sys.exit(entry_point())

The lib uses deprecated DATABASE_NAME which makes it crash

...site-packages/django_pytest/conftest.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django.conf.LazySettings object at 0x21b2850>, name = 'DATABASE_NAME'

    def __getattr__(self, name):
        if self._wrapped is empty:
            self._setup(name)
>       return getattr(self._wrapped, name)
E       AttributeError: 'Settings' object has no attribute 'DATABASE_NAME'

User creation funcargs not re-entrant

The user creation funcargs in conftest.py isn't re-entrant. Second request raises an exception ending in this:

E   IntegrityError: column username is not unique

I'll be returning with a pull request fixing this shortly.

Could the line `settings.DEBUG = False` in conftest.py be made optional?

Hello (again, I just made a pull request /w South support in it),

The line settings.DEBUG = False is triggering a for me undesired behaviour in DjangoCMS. I'm wondering if you think it could be made optional, along these lines:

if not hasattr(settings, 'DEBUG'):
    settings.DEBUG = False

If you think it's a good idea I can make another pull request with that change in it.

Cheers, and thanks for the library! /Jacob

Deprecation Warning

Hi!

When I launch my application django, I get the following error:

DeprecationWarning: Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.
DeprecationWarning

My configuration is:
Python 2.6.1
Django 1.3.1
Django-Pytest 0.1.5

Can you help me?

Thx.

AttributeError when used with the pep8 plugin

Hey when trying to use django pytest plugin with the latest pep8 plugin I get the following error:

item = <Pep8Item 'some_file.py'>

    def is_django_unittest(item):
        """
        Returns True if the item is a Django test case, otherwise False.
        """

>       return hasattr(item.obj, 'im_class') and issubclass(item.obj.im_class, DjangoBaseTestCase)


    def get_django_unittest(item):
E   AttributeError: 'Pep8Item' object has no attribute 'obj'

venv/lib/python2.7/site-packages/pytest_django/utils.py:32: AttributeError

It looks is_django_unittest assumes the item has an obj attribute, which maybe true for most tests but not for Pep8Items. I believe the fix is to update the logic of is_django_unittest to check for the presence of the obj attribute.

module versions for reference:

pytest==2.2.4
pytest-cache==0.9
pytest-cov==1.6
pytest-django==1.4
pytest-pep8==1.0.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.