Hi Florian,

I've had some success with:

import unittest

class MyTestClass (unittest.TestCase):
        def test_something (self):

def test_suite ():
    return unittest.TestLoader().loadTestsFromTestCase(MyTestClass)

if __name__ == '__main__':

Florian Lindner wrote:
I've tried to add a test to my package (I must confess it's my first test.)

I've added an directory "tests", created an empty __init__.py in it and a file named test_proxycache.py which contains:

import unittest
from zope.testing.doctestunit import DocTestSuite
from zope.app.container.tests.test_icontainer import TestSampleContainer

from ProxyCache.proxycache import ProxyCache
class Test(TestSampleContainer):
    def makeTestObject(self):
        return ProxyCache()
def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(Test) ))
if __name__ == "__main__":

as a first step.

Now I try to run the tests:

[EMAIL PROTECTED] ~/Zope3 $ python test.py -vpu --dir ../Desktop/zope/lib/python/ProxyCache/
Running tests at level 1
Traceback (most recent call last):
  File "test.py", line 61, in ?
    result = testrunner.run(defaults)
  File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 256, in run
    failed = not run_with_options(options)
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 365, in run_with_options
    tests_by_layer_name = find_tests(options, found_suites)
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1033, in find_tests
    for suite in found_suites:
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1072, in find_suites
    for fpath, package in find_test_files(options):
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1138, in find_test_files
    for f, package in find_test_files_(options):
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1166, in find_test_files_
    for (p, package) in test_dirs(options, {}):
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1220, in test_dirs
    p = import_name(p)
File "/home/florian/Zope3/src/zope/testing/testrunner.py", line 1236, in import_name
ValueError: Empty module name

tried also some variations but the error does not change.

What's wrong there?


Zope3-users mailing list

Reurbanise - Urban Sustainability
ph: (03) 3528 055, mobile: 0274 992 569
Zope3-users mailing list

Reply via email to