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

Phlip phlip2005 at gmail.com
Thu Nov 25 17:05:51 PST 2010


> I am now converting my brand-new, blue-sky, make-or-break project to
> use your tester. Don't let me down!

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:

[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