Unit testing frameworks

andrew cooke andrew at acooke.org
Wed Mar 25 07:16:31 EDT 2009


Fabio Zadrozny wrote:
>> not exactly a framework, but useful while working on small projects -
>> you
>> can run tests from inside eclipse (using the pydev plugin for python).
>> it's easy to run all tests or some small subset (although it is a bit
>> buggy for 3.0).
>
> What exactly is not working with 3.0? (couldn't find any related bug
> report on that).


i don't have the project open at the moment, but iirc you cannot run all
modules in a package by clicking only on the package.  actually, that may
be 2.6.  let me check...


ok, so i have a project that works with 2.6 or 3.0, and i can swap between
those by selecting the appropriate interpreter in pydev's preferences (i
describe this just in case it is relevant).

in 3.0, i can run an individual test module (single file) by right
clicking and selecting "run as..." and "python unit test".  i can select
all modules in a packages by shift-clicking (ie selecting all modules) and
doing the same.

but in 3.0 i cannot click on a package (directory), run it as a test, and
so run all test modules inside the package.  not even the top "src"
directory.  the error is:

Traceback (most recent call last):
  File
"/home/andrew/pkg/eclipse/plugins/org.python.pydev.debug_1.4.0/pysrc/runfiles.py",
line 253, in <module>
    PydevTestRunner(dirs, test_filter, verbosity).run_tests()
  File
"/home/andrew/pkg/eclipse/plugins/org.python.pydev.debug_1.4.0/pysrc/runfiles.py",
line 234, in run_tests
    files = self.find_import_files()
  File
"/home/andrew/pkg/eclipse/plugins/org.python.pydev.debug_1.4.0/pysrc/runfiles.py",
line 148, in find_import_files
Finding files...
    os.path.walk(base_dir, self.__add_files, pyfiles)
AttributeError: 'module' object has no attribute 'walk'


now, in contrast, in 2.6, i can do all the above *except* intermediate
packages (which may be just the way modules work in python - looks like it
cannot import from unselected modules).

this is with a homebuilt 3.0 - Python 3.0 (r30:67503, Jan 16 2009,
06:50:19) and opensuse's default 2.6 - Python 3.0 (r30:67503, Jan 16 2009,
06:50:19) - on Eclipse 3.3.2 with pydev 1.4.0

sorry for not reporting a bug - i assumed you'd know (and the workarounds
described above meant i wasn't stalled).

i also have eclipse 3.4.2 with pydev 1.4.4.2636 on a separate machine (ie
new versions), and i can try there if you want (it will take a while to
get the source there, but is not a problem).

andrew





More information about the Python-list mailing list