Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1075 from mrosanes/rmenv_db
Browse files Browse the repository at this point in the history
Get ms_properties from db properties
  • Loading branch information
reszelaz authored Mar 6, 2019
2 parents c4abf16 + 94e4169 commit 04e6e67
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/sardana/tango/macroserver/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,32 @@ def setUp(self, properties=None):
self.tearDown()

def tearDown(self):
"""Remove the Pool instance.
"""Remove the MacroServer instance and its properties file.
"""
dft_ms_properties = os.path.join(MacroServerClass.DefaultEnvBaseDir,
MacroServerClass.DefaultEnvRelDir)
ds_inst_name = self.ms_ds_name.split("/")[1]

self._msstarter.cleanDb(force=True)
self._msstarter = None
self.macroserver = None
self.door = None
ms_properties = dft_ms_properties % {"ds_exec_name": "MacroServer",
"ds_inst_name": ds_inst_name}

db = PyTango.Database()
prop = db.get_device_property(self.ms_name, "EnvironmentDb")
ms_properties = prop["EnvironmentDb"]
if not ms_properties:
dft_ms_properties = os.path.join(
MacroServerClass.DefaultEnvBaseDir,
MacroServerClass.DefaultEnvRelDir)
ds_inst_name = self.ms_ds_name.split("/")[1]
ms_properties = dft_ms_properties % {
"ds_exec_name": "MacroServer",
"ds_inst_name": ds_inst_name}
ms_properties = os.path.normpath(ms_properties)
os.remove(ms_properties)
try:
os.remove(ms_properties)
except Exception, e:
msg = "Not possible to remove macroserver environment file"
print(msg)
print("Details: %s" % e)


if __name__ == '__main__':
Expand Down

0 comments on commit 04e6e67

Please sign in to comment.