Opened 13 years ago
Closed 12 years ago
#355 closed defect (fixed)
nose and modules with optional library deps
Reported by: | Elrond | Owned by: | Elrond |
---|---|---|---|
Priority: | minor | Milestone: | 0.3.3 |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description (last modified by )
During unit tests nose imports every ``*.py`` it finds in the tree. It does so to search for unit tests there. If the import fails, this gives an error in the final unit test results. For GMG this can fail, because some modules import optional libraries (video for example). Currently known options: 1. Add hard dependencies again for all optional libraries. Not nice, but would solve the problem at hand. 2. Rewrite the affected modules to somehow gracefully handle the situation and not error. Not really nice, but acceptable. 3. Change ``runtests.sh`` to call nose in a way, that tests are only searched in ``mediagoblin.tests``. This seems the nicest way.
Change History (6)
comment:2 by , 13 years ago
Update: This affects only ``__init__.py`` and modules imported from there. Some random ``models.py`` importing say sqlalchemy doesn't trigger this issues on its own.
comment:4 by , 12 years ago
Giving a path to nosetests can easily prevent most of this problem. It tells it to search only for tests in the given directory, like so:
./runtests.sh $PWD/mediagoblin/tests
We could easily modify runtests.sh
to add this argument on its own, if no other relevant args are given.
Do we want that?
Are all our tests going to be in mediagoblin/tests
? Or are tests for core plugins going to be in their individual directories? Maybe not, because mediagoblin/tests/__init__.py
has some setup code for tests.
What do others think?
comment:5 by , 12 years ago
Milestone: | → 0.3.3 |
---|---|
Owner: | set to |
Status: | accepted → assigned |
The above mentioned idea for changing runtests.sh
has been implemented by me in 7dec9f92f345df4bb33d399f60c49544c7e60bf6
.
In my opinion, we can close this issue. Any vetos? (set milestone to next release, so we revisit it sooner than later for just closing or postponing.)
comment:6 by , 12 years ago
Description: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Closed.