olebole / python-cpl

Python bindings for CPL recipes
http://pypi.python.org/pypi/python-cpl
GNU General Public License v2.0
10 stars 5 forks source link

TestRecipe fails when there is a test.fits file #23

Open hugobuddel opened 5 years ago

hugobuddel commented 5 years ago

TestRecipe.py fails when there is a file called test.fits present in the current working directory:

$ python -m pytest -x -s [..]/python-cpl/test/TestRecipe.py 
[...]
Message: 'Writing FITS image product(THE_PRO_CATG_VALUE): rtest.fits'
Arguments: None
F

=== FAILURES ===
___ RecipeLog.test_error ___

self = <TestRecipe.RecipeLog testMethod=test_error>

    def test_error(self):
        '''"log" attribute of the CplError object'''
        try:
            self.recipe('test.fits')
        except cpl.CplError as r:
            res = r
        # Check that we get a not-empty list back
>       self.assertTrue(isinstance(res.log, list))
E       UnboundLocalError: local variable 'res' referenced before assignment

[..]/python-cpl/test/TestRecipe.py:952: UnboundLocalError
=== 1 failed, 71 passed in 8.91 seconds ===

[..]/python-cpl/test/TestRecipe.py:952: UnboundLocalError

Trivial thing to work around of course, just removing the file.