Are you still getting two tests folders in a quickstart in a4? I believe it somebody already fixed it.
--Mark On Wed, Sep 3, 2008 at 10:51 PM, Lukasz Szybalski <[EMAIL PROTECTED]> wrote: > > On Mon, Aug 4, 2008 at 1:25 AM, Alberto Valverde <[EMAIL PROTECTED]> wrote: >> >> Doug Latornell wrote: >>> I'm looking for a little insight regarding testing TG2 apps. There >>> doesn't appear to be a testing page in the docs, so perhaps once I get >>> a handle on things I can contribute to one. >>> >> >> Take a look at paste.fixture's docs. BTW, I think TG2 should migrate to >> webtest which is sort of paste.fixture 2. Opinions? >>> In a quickstart-ed app (let's call it MyApp), why are there 2 test >>> directories - MyApp/tests/ and MyApp/myapp/tests/ ? The former has a >>> test_controllers.py file in it with a prototype controller test in >>> it. The latter has some test setup code in __init__.py that looks to >>> do much the same thing as test_controllers.py but in a different (more >>> robust?) way. >>> >> >> The former should dissappear from tg.devtools template, IMHO. You're >> safe deleting and using only myapp/tests. >>> I know from fiddling around that if I put the contents of MyApp/tests/ >>> test_controllers.py in MyApp/myapp/tests/test_models.py nosetests >>> finds and executes the test as expected. >>> >>> Are the 2 different test directories simply available choices, or are >>> there reasons why some tests have to go one place, and some another? >>> >> >> Not sure, my guess is that someone accidentally left it there ;) >>> An aside regarding MyApp/tests/test_controllers.py: Shouldn't >>> >>> config = 'config:'+(os.path.abspath(os.path.basename(__name__) >>> +'/../../ >>> development.ini#main')) >>> >>> be >>> >>> config = 'config:' + (os.path.abspath(os.path.basename(__name__) >>> + '/../ >>> development.ini#main')) >>> >> >> Try inheritting from the base TestCase declared in >> yourapp/tests/__init__.py which configures an app for you, wraps it with >> TestApp and binds it to testcase.app. >>> When I run nosetests in the MyApp directory with the first one I get a >>> traceback because development.ini is not being found in the directory >>> above MyApp. >>> >> I had this problem too until I removed that test_controllers.py file > > Could somebody remove the tests folder in a first level > myapp > --\tests <---this one > --\myapp > ----\tests > > otherwise the default tests don't run: > reading manifest file 'addressbook.egg-info/SOURCES.txt' > writing manifest file 'addressbook.egg-info/SOURCES.txt' > running build_ext > E > ====================================================================== > ERROR: Failure: OSError (File '/home/lucas/tmp/development.ini' not found) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/loader.py", > line 364, in loadTestsFromName > addr.filename, addr.module) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/importer.py", > line 39, in importFromPath > return self.importFromDir(dir_path, fqname) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/importer.py", > line 84, in importFromDir > mod = load_module(part_fqname, fh, filename, desc) > File "/home/lucas/tmp/addressbook/tests/test_controller.py", line 7, > in <module> > app = TestApp(config) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/fixture.py", > line 132, in __init__ > app = loadapp(app, relative_to=relative_to) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg/paste/deploy/loadwsgi.py", > line 204, in loadapp > return loadobj(APP, uri, name=name, **kw) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg/paste/deploy/loadwsgi.py", > line 224, in loadobj > global_conf=global_conf) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg/paste/deploy/loadwsgi.py", > line 248, in loadcontext > global_conf=global_conf) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg/paste/deploy/loadwsgi.py", > line 275, in _loadconfig > loader = ConfigLoader(path) > File > "/home/lucas/tmp/tg2env/lib/python2.5/site-packages/PasteDeploy-1.3.2-py2.5.egg/paste/deploy/loadwsgi.py", > line 344, in __init__ > "File %r not found" % filename) > OSError: File '/home/lucas/tmp/development.ini' not found > > ---------------------------------------------------------------------- > Ran 1 test in 0.243s > > FAILED (errors=1) > > > > ***But when you take out that folder everything works. > > " > writing manifest file 'addressbook.egg-info/SOURCES.txt' > running build_ext > > ---------------------------------------------------------------------- > Ran 0 tests in 0.045s > > OK > " > > > I guess it needs to be removed from the template. > > Thanks, > Lucas > > > > -- Mark Ramm-Christensen email: mark at compoundthinking dot com blog: www.compoundthinking.com/blog --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

