Feature #748
cdb python api ready for merging into maus
100%
Description
Chris T originally put the config db api into maus
The latest version of the python api (revision 4) is ready to be merged into maus. It can be found at https://code.launchpad.net/~antony-wilson/mcdb/mice.cdb.client.api-python and downloaded with bzr branch lp:mcdb
Sorry i still have not got to grips with bzr, how do we get this into maus?
At least for the time being this code will continue to be deployed directly by the online group
Thanks
Antony
Updated by Rogers, Chris over 11 years ago
Great!
Tests fail on my machine
python -m unittest discover src -p 'unittest_*'
Produces lots of errors like
====================================================================== ERROR: test_list_tags (test.unittest_alarmhandler.TestAlarmHandler) Test AlarmHandler list_tags. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cr67/G4MICE/MAUS/mice_cdb_repo/src/test/unittest_alarmhandler.py", line 70, in test_list_tags self._alh.set_url("error") File "/home/cr67/G4MICE/MAUS/mice_cdb_repo/src/cdb/_alarmhandler.py", line 63, in set_url super(AlarmHandler, self).set_url(url) File "/home/cr67/G4MICE/MAUS/mice_cdb_repo/src/cdb/_base.py", line 49, in set_url raise CdbPermanentError("Invalid CDB server URL: " + url) CdbPermanentError: Invalid CDB server URL: error ----------------------------------------------------------------------
Updated by Rogers, Chris over 11 years ago
Also have an error like
====================================================================== ERROR: test_init (test.unittest_base.TestBase) Test _CdbBase __init__. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cr67/G4MICE/MAUS/mice_cdb_repo/src/test/unittest_base.py", line 24, in test_init self.assertRaises(CdbPermanentError, _CdbBase, "ValueError") File "/home/cr67/G4MICE/MAUS/maus_littlefield_2/third_party/install/lib/python2.7/unittest/case.py", line 456, in assertRaises callableObj(*args, **kwargs) File "/home/cr67/G4MICE/MAUS/mice_cdb_repo/src/cdb/_base.py", line 29, in __init__ _cdb_wsdl) CdbTemporaryError: Unable to contact CDB server at http://cdb.mice.rl.ac.ukValueError
Updated by Wilson, Antony over 11 years ago
How annoying. The tests work fine from within eclipse, I'll take a look.
Updated by Wilson, Antony over 11 years ago
It is a PYTHONPATH problem. In order to do unit tests I have had to provide a mock suds module, this is in the scr/test directory. You need to include the scr/test directory at the beginning of your PYTHONPATH and then it should work.
Updated by Wilson, Antony over 11 years ago
Alternately go into the test dir and run
python -m unittest discover test -p 'unittest_*'
Updated by Littlefield, Matthew over 11 years ago
Is there any way to pull the code from Antony's branch? I've tried
bzr merge lp:~antony-wilson/mcdb/mice.cdb.client.api-python bzr: ERROR: Branches have no common ancestor, and no merge base revision was specified.
Or shall I download the files by hand and put them in the correct directories? Thank you :-)
Updated by Tunnell, Christopher over 11 years ago
- Project changed from Computing and Software to MAUS
Updated by Tunnell, Christopher over 11 years ago
There were some changes made to make it work with MAUS. It's a branch at:
https://code.launchpad.net/mcdb
so you'd need to merge those two branches then move the MAUS version into MAUS. Ideally in the future we just edit the version in MAUS.
Updated by Rogers, Chris over 11 years ago
- Category set to Build System
- Target version set to Future MAUS release
I understood from previous comments that Antony wanted to keep it as a third party library...
what changes were needed to make it work with MAUS? I guess I should dig into the cdb stuff
Updated by Tunnell, Christopher over 11 years ago
Well, first I removed all the 'junk lines' and replaced them with pylint exceptions.
I also hooked up the CDB tests to our test suite. That's about it.
If you can come up with a better way to integrate it, let me know, but like the unpacker there are normally changes that need to be made to make it useful.
Updated by Rogers, Chris over 11 years ago
I added it as a third party library to e.g. bzr+ssh://bazaar.launchpad.net/~chris-rogers/maus/libxml2_test/. I'm using this branch as a staging point for merging the geometry stuff. Build works and everything, looks good (though we have some issues on our side we need to address).
- Would it be possible to include the tests in the tarball - in particular, we made use of Antony's suds mock-up for testing but that doesn't come in the tarball?
- Would it be possible to make a more permananent location for release tarballs? Don't mind launchpad, but I think they have ability to post download files somewhere. (At the moment I put in an http link to Antony's branch in launchpad, but this is probably rather a temporary solution).
Updated by Rogers, Chris over 11 years ago
Humm, I dipped my toes I guess the cdb handles the calls out to suds. So if we're testing our calls to cdb, either we mock-up cdb (pita) or we ask antony to allow switching at runtime between real suds and mock-up suds. For example, could imagine something like
if suds_mockup_mode: import suds_mockup as suds else: import suds
...or whatever. Thoughts?
Updated by Tunnell, Christopher over 11 years ago
There are many ways to do it. We could also just simplify things by not having the MCDB unit tests run with our test suite?
Updated by Rogers, Chris over 11 years ago
Right, but the suds mock-up was used by Matt to do his tests. I think Matt is going to do some mock-up of cdb instead, as no response from Antony and I couldn't get him to pick up his phone.
Updated by Tunnell, Christopher over 11 years ago
wait, updated by Rogers four hours ago? Aren't you in the US?
Updated by Rogers, Chris over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Close - I did a cdb mockup
Updated by Rogers, Chris over 11 years ago
- Status changed from Closed to Open
- % Done changed from 100 to 0
Shouldn't have closed it - it is fixed in rogers branch but won't be fixed until I do the merge.
Updated by Rogers, Chris over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Merged in release 0.1.0...
Updated by Rogers, Chris over 11 years ago
- Target version changed from Future MAUS release to MAUS-v0.1.1