diff --git a/pyqchem/cache.py b/pyqchem/cache.py index ae100e9..d596a4f 100644 --- a/pyqchem/cache.py +++ b/pyqchem/cache.py @@ -24,11 +24,14 @@ def __new__(cls, *args, **kwargs): cls.__instance__ = super(SimpleCache, cls, ).__new__(cls) return cls.__instance__ - def __init__(self): + def __init__(self, filename=None): """ Constructor """ + if filename is not None: + self._calculation_data_filename = filename + # python 2 compatibility if not '_calculation_data_filename' in dir(self): self._calculation_data_filename = 'calculation_data.db' @@ -112,13 +115,17 @@ def __new__(cls, *args, **kwargs): cls.__instance__ = super(SqlCache, cls, ).__new__(cls) return cls.__instance__ - def __init__(self): + def __init__(self, filename=None): """ Constructor """ + if filename is not None: + self._calculation_data_filename = filename + # python 2 compatibility if not '_calculation_data_filename' in dir(self): + print('python 2') self._calculation_data_filename = 'calculation_data.db' self._conn = sqlite3.connect(self._calculation_data_filename) diff --git a/pyqchem/qchem_core.py b/pyqchem/qchem_core.py index d59172c..37ec1e6 100644 --- a/pyqchem/qchem_core.py +++ b/pyqchem/qchem_core.py @@ -11,8 +11,7 @@ # Backwards Compatibility def redefine_calculation_data_filename(filename): - cache = CacheSystem() - cache.redefine_calculation_data_filename(filename) + cache = CacheSystem(filename=filename) # Check if calculation finished ok diff --git a/tests/rasci_test.py b/tests/rasci_test.py index 5dfb432..b6c42ee 100644 --- a/tests/rasci_test.py +++ b/tests/rasci_test.py @@ -13,7 +13,7 @@ if 'USER' in os.environ and os.environ['USER'] == 'travis': recalculate = False else: - recalculate = True + recalculate = False class HydrogenTest(unittest.TestCase): diff --git a/tests/test_data.db b/tests/test_data.db index e8982b6..61ca92a 100644 Binary files a/tests/test_data.db and b/tests/test_data.db differ