I was not having the solution, but I thought to tell you to look there since it smell like it was coming from there :)
Richard On Fri, May 15, 2015 at 4:41 PM, Ian W. Scott <scotti...@gmail.com> wrote: > Never mind! I discovered the problem in my conftest.py file. Thanks anyway! > > > On Friday, May 15, 2015 at 3:57:47 PM UTC-4, Ian W. Scott wrote: >> >> I've been successfully using pytest for quite a while now to do unit >> testing for my web2py apps. Today, after upgrading to the latest web2py >> version (Version 2.10.4-stable+timestamp.2015.04.26.15.11.54) my tests >> won't run. When I try to run the tests in a test file (in the tests/ >> directory) web2py tries to import that test file as a module and raises an >> ImportError. >> >> For example, I have a test file at >> myapp/tests/modules/test_greek_parser.py. I try to run it like this: >> >> python2.7 -m pytest -xvs applications/paideia/tests/modules/ >> test_greek_parser.py >> >> The error looks like this: >> >> ================================================= test session starts >> ===================================== >> platform linux2 -- Python 2.7.9 -- py-1.4.20 -- pytest-2.5.2 -- >> /usr/bin/python >> >> collected 0 items / 1 errors >> >> >> >> ======================================================= ERRORS >> ============================================ >> ______________________ ERROR collecting applications/paideia/tests/ >> modules/test_greek_parser.py ___________ >> /usr/local/lib/python2.7/dist-packages/py/_path/local.py:620: in >> pyimport >> > __import__(modname) >> >> gluon/custom_import.py:89: in custom_importer >> >> > raise ImportError, 'Cannot import module >> %s' % str(e) >> E ImportError: Cannot import module >> 'applications.paideia.modules.test_greek_parser' >> =============================================== 1 error in 0.01 seconds >> =================================== >> >> >> It's not surprising that custom_importer can't find the module, since it >> doesn't exist! It's looking for a file with my test file name, but looking >> in the myapp/modules/ directory. I'm not even sure why gluon is trying to >> import something with that file name at all. >> >> Now, if this isn't strange enough already, this import error only happens >> with some of my test files. Others (in the same tests/modules/ directory) >> run without a hitch. But I can't for the life of me find any significant >> difference between the two. >> >> I'm attaching a couple of files here in case they help shed any light: >> >> 1. my conftest.py which is read by pytest before running the tests (this >> seems to be fine; it sits in the parent 'tests' directory) >> 2. test_paideia_utils.py (which runs without any problem) >> 3. test_greek_parser.py (which raises the import error) >> >> I realize that this may appear to be a pytest problem rather than a >> web2py problem. But the error is happening because custom_importer is being >> called somewhere, so at the least it looks like some recent update has >> introduced an incompatibility with pytest. Again, these tests were all >> running fine (with the same conftest.py) >> >> Thanks again for any help. I'm really at a loss with this one! >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.