Print

Print


Hi Jacek,

I doubt that we can write unit test for every single line of code 
and every possible behavior. Standard problem with that code is
that for correct behavior it needs database instance (and bunch 
of other things because it's Flask stuff) so it's hard to do it 
with standalone setup. The only reasonable wway to test it now is 
the integration test, that is exactly what you do. 

Things could become easier after we switch to sqlalchemy where 
one could substitute sqlite for mysql for testing purposes but it 
will need significant effort to do that (I'm sure our code has 
lots of mysql-specific queries).

What could potentially help in this case is static analysis tool 
like pylint. It's not trivial to use but I try to run it on our 
code and it is very helpful, still it cannot catch 100% of errors 
due to Python dynamic nature.

Cheers,
Andy


Becla, Jacek wrote on 2015-08-27:
> Andy
> 
> I am trying Qserv with the new sqlalchemy based db module.
> 
> Surprisingly everything compiled, built, and all unit tests passed.
> 
> Unsurprisingly, the integration test immediately failed.
> 
> I am addressing this email to you because the first problem
> I ran into is in wmgr
> 
>    File
> "/usr/local/home/becla/stack/repos/qserv_testdata/python/lsst/qserv/tests
> / mysqlDbLoader.py", line 89, in prepareDatabase
>      self.czar_wmgr.dropDb(self._dbName, mustExist=False)
>    File
> "/usr/local/home/becla/stack/repos/qserv/lib/python/lsst/qserv/wmgr/clien
> t .py", line 316, in dropDb
>      self._requestJSON('dbs', dbName, method='DELETE')
>    File
> "/usr/local/home/becla/stack/repos/qserv/lib/python/lsst/qserv/wmgr/clien
> t .py", line 690, in _requestJSON
>      response = self._request(svc, resource, method=method,
> params=params, data=data, headers=headers)
>    File
> "/usr/local/home/becla/stack/repos/qserv/lib/python/lsst/qserv/wmgr/clien
> t .py", line 666, in _request
> 
> 
> which makes me wonder if we could come up with some simple
> unit test to expose this sort of problems.
> 
> Do you have any advice what the easiest way to test / debug it
> would be?
> 
> thanks,
> Jacek
>
  


########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the QSERV-L list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=QSERV-L&A=1