[TIP] pytest-2.0: asserts++, unittest++, reporting++, config++, docs++

holger krekel holger at merlinux.eu
Fri Nov 26 00:42:49 PST 2010


Hi Phlip,

On Thu, Nov 25, 2010 at 17:05 -0800, Phlip wrote:
> > I am now converting my brand-new, blue-sky, make-or-break project to
> > use your tester. Don't let me down!

Heh, i'd like to help, am always looking for real-world feedback
and issues :)
 
> Aaand, i would prefer to migrate case-by case. Is there some way to
> invoke a single suite, such as from within the Django test runner?
> 
> I'm trying the hard way - throwing everything to pytest via "pip
> install django-pytest", but I get this mess:

haven't used or tested django-pytest myself ...
The below error seems to indicate pytest is not installed. 
Maybe django-pytest does not require it and you need to 
install pytest manually? 

As to your case-by-case strategy: what happens if you simply
run "py.test" (2.0) on your code base today? 

cheers,
holger

P.S.: I am often at #pylib on irc.freenode.net
where we could sort out things a bit more realtime.
Otherwise let's stick to one mailing list, i am fine with 
sticking to just TIP and to take things to private mail
if we have more than a couple of to and fros.

> [localhost] run: python manage.py test --settings=settings.test --verbosity=0
> Traceback (most recent call last):
>   File "manage.py", line 11, in <module>
>     execute_manager(settings)
>   File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py",
> line 438, in execute_manager
>     utility.execute()
>   File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py",
> line 379, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/pymodules/python2.6/django/core/management/base.py",
> line 191, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/usr/lib/pymodules/python2.6/django/core/management/base.py",
> line 220, in execute
>     output = self.handle(*args, **options)
>   File "/usr/local/lib/python2.6/dist-packages/django_pytest/management/commands/test.py",
> line 40, in handle
>     super(Command, self).handle(*args, **kwargs)
>   File "/usr/lib/pymodules/python2.6/django/core/management/commands/test.py",
> line 34, in handle
>     failures = TestRunner(test_labels, verbosity=verbosity,
> interactive=interactive)
>   File "/usr/local/lib/python2.6/dist-packages/django_pytest/test_runner.py",
> line 7, in run_tests
>     load_entry_point('py>=1.0.0', 'console_scripts', 'py.test')()
>   File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 305,
> in load_entry_point
>     return get_distribution(dist).load_entry_point(group, name)
>   File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2243,
> in load_entry_point
>     raise ImportError("Entry point %r not found" % ((group,name),))
> ImportError: Entry point ('console_scripts', 'py.test') not found
> 
> Uh, I did all the things this said to:
> http://pypi.python.org/pypi/django-pytest/0.1.4
> 
> Except I didn't call from py.test. If I had, I suspect I would not
> achieve migrate case by case, which is more important to me because my
> fixtures are somewhat elaborate!
> 
> -- 
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand
> 

-- 



More information about the testing-in-python mailing list